小商店API:SPU_ADD发布商品问题
https://developers.weixin.qq.com/doc/ministore/minishopopencomponent/API/spu/add_spu.html
spu_add,返回 errorcode-100020,这个是什么情况,
案例代码如下:
$data = new stdClass();
$data->out_product_id = $out_product_id;
$data->title = $title;
$data->sub_title = $sub_title;
$data->head_img = $arr_head_img;
$data->desc_info = new stdClass();
$data->desc_info->imgs = $desc_info_imgs;
$data->brand_id = $brand_id;//商家需要申请品牌
$cats = array();
$cats[0] = '{"cat_id":1701,"level":0}';
$cats[1] = '{"cat_id":1702,"level":0}';
$cats[2] = '{"cat_id":1713,"level":0}';
$data->cats = $cats; //商家需要先申请可使用类目,默认先添加为这个,后续可以再修改的
// $attr_obj = new stdClass();
// $attr_obj->attr_key = "";
// $attr_obj->attr_value = "";
$data->attrs = array();
$data->express_info = new stdClass();
$data->express_info->template_id = $template_id;
$url = "https://api.weixin.qq.com/product/spu/add?access_token=";
$url = $url.$this->GetToken();
$res = $this->curl->Curl_POST($url,json_encode($data));
1 回复
class Cats{
var $cat_id;
var $level;
function __construct($cat_id,$level){
$this->cat_id = $cat_id;
$this->level = $level;
}
}
$cats[0] = '{"cat_id":1701,"level":0}';
$cats[1] = '{"cat_id":1702,"level":0}';
$cats[2] = '{"cat_id":1713,"level":0}';
上面这些应该改成下面这些:
$cats[0] = new Cats(1701,0);
$cats[1] = new Cats(1702,0);
$cats[2] = new Cats(1713,0);
还得自己来分析解决。
100020是参数错误,所以就是上面这些问题。