关于API 请求新增产品无法获取meta_title remark等值 的BUG,以及url_key无法导入的BUG。

bug问题 · d157917936 · 于 4年前 发布 · 1767 次阅读

如图, 用http://fecshop.appapi.fancyecommerce.com/v1/product/addone 这个API 添加产品。 这二个字段无法新增数据 , 左侧是新增以后返回的数据 , 右侧是新增之前传递的数据 , 返回的数据当中 meta_title和 remark 都是空值 ,同时url_key 无法使用自定义后缀名的问题, URL keY, 经过测试, 好像这个参数也没有生效, 是直接 拿 name生成出来的url key, 不知道 这个是不是一个BUG。

共收到 6 条回复
Fecmall#14年前 0 个赞

1.找时间处理一下

2.自己去找找相应的文件,很容易自己处理一下的,去找找代码。

d157917936#34年前 0 个赞

我看了下 https://github.com/fecshop/yii2_fecshop/blob/master/services/product/ProductApi.php 这个文件的源代码 。 在 大约 332行处, // 选填

    $remark = $post['remark'];
    if (!$remark) {
        $this->_param['remark'] = $remark;
    }

和 360行

// 选填 产品的url key

    $url_key = $post['url_key'];
    if (!$url_key) {
        $this->_param['url_key'] = $url_key;
    }

这里的判断 应该是if($remark) 和 if($url_key), 不应该是非的判断 。

d157917936#44年前 0 个赞

理伦上应该是所有的选填 应该都判断 反了条件, // 选填

    $remark = $post['remark'];
    if (!$remark) {
        $this->_param['remark'] = $remark;
    }
    // 选填
    $relation_sku = $post['relation_sku'];
    if (!$relation_sku) {
        $this->_param['relation_sku'] = $relation_sku;
    }
    // 选填
    $buy_also_buy_sku = $post['buy_also_buy_sku'];
    if (!$buy_also_buy_sku) {
        $this->_param['buy_also_buy_sku'] = $buy_also_buy_sku;
    }
    // 选填
    $see_also_see_sku = $post['see_also_see_sku'];
    if (!$see_also_see_sku) {
        $this->_param['see_also_see_sku'] = $see_also_see_sku;
    }

我个人的理解。

d157917936#54年前 0 个赞

经过测试, 确实是 API 里面 所有的选填的判断 全部条件都写反了。 同时 在428 行 把

    $title = $post['title'];
    if (!empty($title) && is_array($title)) {
        $this->_param['title'] = $title;
    }
	

修改为

    $title = $post['meta_title'];
    if (!empty($title) && is_array($title)) {
        $this->_param['meta_title'] = $title;
    }
	

问题解决。

Fecmall#64年前 0 个赞

meta_titletitle 是没有问题的,因为是多语言,需要是数组的格式。

其他的你指出的是正确的

代码提交:https://github.com/fecshop/yii2_fecshop/commit/0eafd920567da9837f981f5c3099bc1de14ea808

添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics