Giter Club home page Giter Club logo

jd-union-sdk's People

Contributors

asundust avatar hisway avatar sdhou avatar uhowep avatar vangogogo avatar yumufeng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

jd-union-sdk's Issues

JdGateWay 构造函数少了siteId的赋值

`/**
* JdGateWay constructor.
* @param array $config
* @param JdFatory $jdFatory
*/
public function __construct(array $config, JdFatory $jdFatory)
{

    $this->appkey = $config['appkey'];
    $this->appSecret = $config['appSecret'];
    $this->apithId = isset($config['apithId']) ? $config['apithId'] : '';
    $this->apithKey = isset($config['apithKey']) ? $config['apithKey'] : '';
    $this->unionId = $config['unionId'];
    $this->positionId = $config['positionId'];
    $this->pid = $config['unionId'] . '_' . $config['siteId'] . '_' . $config['positionId'];
    $this->jdFatory = $jdFatory;
    $this->isCurl = isset($config['isCurl']) && ($config['isCurl'] == true) ? true : false;
    $this->siteId=$config['siteId'];//缺少赋值
}`

apith推广位创建siteID

src/Api/Apith.php:100

public function createPosition(array $spaceNameList, string $key, $unionType = 1, $type = 4)
{
$param = [
'unionId' => $this->unionId,
'key' => $key,
'unionType' => $unionType,
'type' => $type,
'spaceNameList' => implode(',', $spaceNameList)
];
if ($type == 1) {
$param = array_merge($param, [
'siteId' => $this->siteId
]);
}
return $this->send('createPosition', $param);
}

站点ID,即网站ID/app ID/snsID ,当type传入4以外的值时,siteId为必填
$type == 1 需要改成 $type !== 4

错误处理需要更新下

vendor/yumufeng/jd-union-sdk/src/Tools/JdGateWay.php Line:211

/**
     * 解析参数
     * @param $result
     * @param bool $raw
     * @return mixed
     */
    private function parseReps($result, $raw = false)
    {
        $decodeObject = json_decode($result, true);
        if (is_string($decodeObject)) {
            return $this->setError($decodeObject);
        }
        if (is_null($decodeObject)) {
            return $this->setError("Api返回结果为空");
        }
        if ($this->is_auth === true) {
            if ($raw == true) {
                return $decodeObject;
            }
            if ($decodeObject['code'] != 1) {
                $this->setError($decodeObject['msg']);
                return false;
            }
            return isset($decodeObject['data']) ? $decodeObject['data'] : [];
        } else {
            $nowLists = current($decodeObject);
            if ($nowLists['code'] != 0) {
                var_dump($nowLists);die;
                return $this->setError(isset($nowLists['msg']) ? $nowLists['msg'] : '错误信息');
            }
            $finally = json_decode($nowLists['result'], true);
            if ($finally['code'] != 200) {
                return $this->setError($finally['message']);
            }
            if ($raw == true) {
                return $finally;
            }
            return isset($finally['data']) ? $finally['data'] : [];
        }
    }

打印结果:
array(3) {
["code"]=>
string(1) "8"
["zh_desc"]=>
string(161) "时间戳参数与服务器时间差异大于设定值timestamp=2019-07-28 09:22:09(解决方案参考:http://open.jd.com/home/home#/doc/common?listId=533)"
["en_desc"]=>
string(89) "Invalid Timestamp(Solution reference:http://open.jd.com/home/home#/doc/common?listId=533)"
}


此种情况下,key为 zh_desc,不是msg

望楼主更新下,否则调试不太方便:)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.