切换风格

默认Lavender Sky Flowers Wizard Snow Beige California City Dragon Black London Sunset glow Pink Cloud

17

主题

453

积分

0

精华

用户组 

易积分
260
热心
0
好评
0
求助调用商城api问题[复制链接]
发表于 2019-5-7 23:07:08 | 显示全部楼层 |阅读模式
30如意币
本帖最后由 1280405008 于 2019-5-7 23:31 编辑


请帮忙根据官方文档测试一下怎么添加商品或者读取商品信息

新开了个店铺,才发现有官方接口,但是不知道怎么调用,请大佬帮帮忙



这是放心购商城平台对接文档:http://openapidoc.jinritemai.com/documents/standard.html

下面是我的店铺临时接口,做调试用

  1. Appkey:3343857642052433771
  2. Appsercet:1bec0232f2146cef5faa45107e68da17
复制代码

我用萌新助手测试总是出现  {"err_no":11,"message":"认证失败, sign校验失败"} 信息。可能是api签名问题还是其他啥的,如下图

对接文档中有php请求demo,但我看不太懂,就是下面这个
  1. <pre style='padding: 16px; border-radius: 3px; color: rgba(3, 17, 31, 0.87); text-transform: none; line-height: 1.45; text-indent: 0px; letter-spacing: normal; overflow: auto; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; font-style: normal; font-weight: 400; margin-top: 0px; margin-right: 0px; margin-bottom: 0px !important; margin-left: 0px; word-spacing: 0px; box-sizing: border-box; orphans: 2; widows: 2; background-color: rgb(246, 248, 250); overflow-wrap: normal; -webkit-tap-highlight-color: transparent; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;'><code style='background: none; margin: 0px; padding: 0px; border-radius: 3px; border: 0px currentColor; line-height: inherit; overflow: visible; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; display: inline; white-space: pre; word-break: normal; box-sizing: border-box; overflow-wrap: normal; -webkit-tap-highlight-color: transparent;'>header("Content-Type: text/html;charset=utf-8");
  2. date_default_timezone_set('PRC');

  3. $APP_KEY = 'xxx';
  4. $APP_SECRET = 'xxx';


  5. // url中base参数
  6. $end_time = $timestamp = date('Y-m-d H:i:s', time());
  7. $start_time = date('Y-m-d H:i:s', time() - 36000);
  8. $host = "https://openapi.jinritemai.com";
  9. $v = "1";
  10. $c = "order";
  11. $a = "list";
  12. $method = $c . "." . $a;


  13. // 参数按key值排序
  14. $param_arr = array(
  15.     "start_time" => $start_time,
  16.     "end_time" => $end_time,
  17.     "order_by" => "create_time",
  18.     "size" => "100"
  19. );
  20. ksort($param_arr);
  21. $param_json = json_encode($param_arr);


  22. // 计算签名
  23. $str = "app_key" . $APP_KEY . "method" . $method . "param_json" . $param_json . "timestamp" . $timestamp . "v" . $v;
  24. $md5_str = $APP_SECRET . $str . $APP_SECRET;
  25. $sign = md5($md5_str);

  26. // 构造请求url
  27. $base_url = $host . '/' . $c . '/' . $a . '?';
  28. $base_url = $host . '/' . $c . '/' . $a;


  29. // 生成请求url
  30. $url = $base_url . $query_url;

  31. $request_data = [
  32.         'app_key' => $APP_KEY,
  33.         'method' => $method,
  34.         'param_json' => $param_json,
  35.         'timestamp' => $timestamp,
  36.         'v' => $v,
  37.         'sign' => $sign,
  38. ];

  39. $curl = curl_init();

  40. curl_setopt($curl, CURLOPT_URL, $base_url);
  41. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  42. curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($request_data));
  43. $res = curl_exec($curl);
  44. curl_close($curl);
  45. </code></pre>

  46. <div> </div>
复制代码

这是官方获取商品列表的调用示例
https://openapi.jinritemai.com/product/list?app_key=your_app_key_here&method=product.list¶m_json={"page":"0","size":"20"}×tamp=2018-06-19 16:06:59&v=1&sign=your_sign_here


谁能通过我上面给出的Appkey和Appsercet 测试一下,能够返回数据就好,再教我怎么弄


日期要改到今年4月份,刚开的店铺

我QQ1280405008,能解决也可以留下qq






QQ截图20190507224742.png
QQ截图20190507224815.png
QQ截图20190507233055.png

最佳答案

查看完整内容

这是我调试的结果
易如意中文编程学习交流论坛有你更精彩~
回复

使用道具 举报

45

主题

1250

积分

4

精华

用户组 

易积分
5541
热心
99
好评
17

热心会员

发表于 2019-5-7 23:07:09 | 显示全部楼层
这是我调试的结果

9X$~FVT2{`)[0E$QB{%WLJM.png
个人博客:blog.icodef.com
回复

使用道具 举报

349

主题

5099

积分

25

精华

用户组 

易积分
18446
热心
102
好评
136
QQ

热心会员国庆节纪念勋章活跃会员

发表于 2019-5-8 11:03:47 | 显示全部楼层
不知道接口问题还是你是APPkey和Appsercet改了,再或者我调用错误{"err_no":6,"message":"认证失败02"}
易如意中文编程学习交流论坛有你更精彩~
回复

使用道具 举报

17

主题

453

积分

0

精华

用户组 

易积分
260
热心
0
好评
0
发表于 2019-5-8 12:02:01 | 显示全部楼层
易如意 发表于 2019-5-8 11:03
不知道接口问题还是你是APPkey和Appsercet改了,再或者我调用错误{"err_no":6,"message":"认证失败02"} ...

appkey都没改啊
易如意中文编程学习交流论坛有你更精彩~
回复

使用道具 举报

0

主题

0

积分

0

精华

用户组 

易积分
0
热心
0
好评
0
发表于 2019-5-14 16:13:14 | 显示全部楼层

afasfdawfe
易如意中文编程学习交流论坛有你更精彩~
回复

使用道具 举报

0

主题

0

积分

0

精华

用户组 

易积分
0
热心
0
好评
0
发表于 2019-5-14 16:13:46 | 显示全部楼层

求助调用商城api问题
易如意中文编程学习交流论坛有你更精彩~
回复

使用道具 举报

QQ|sitemap|免责声明|RGB颜色对照表|手机版|小黑屋| 易如意 - E4A中文编程学习交流论坛

GMT+8, 2025-5-2 22:51 , Processed in 0.096361 second(s), 39 queries .

Powered by Discuz! X3.4

© 2001-2018 eruyi.cn

返回顶部