导入佣金联结凭证

时间:2019-03-25 13:46:32

标签: php mysql commission-junction

我正在尝试将数据从委托联结导入MySQL中的数据库。我成功导入了广告商,但是仍然无法导入凭证。出现问题的参数是“ postingDate”,“ promotion-end-date”和“ promotion-start-date”。

public function import()
{
    $get_url = $this->get_response_by_url_voucher();

    $xml = new SimpleXMLElement($get_url);
    $json_string = json_encode($xml);    
    $getvoucher = json_decode($json_string, TRUE);
    $this->import_voucher($getvoucher);
}   

public function import_voucher($getvoucher = [])
{
    if($getvoucher) 
    {
        foreach($getvoucher['links']['link'] as $voucher)
        {   
            $attr = [
                'link-id'              => $voucher['link-id'],
                'advertiser-id'        => $voucher['advertiser-id'],
                'description'          => $voucher['description'],
                'coupon-code'          => $voucher['coupon-code'],
                'link-name'            => $voucher['link-name'],
                'promotion-type'       => $voucher['promotion-type'],
                'clickUrl'             => $voucher['clickUrl'],
                'promotion-start-date'   => $voucher['promotion-start-date'],
                'promotion-end-date'   => $voucher['promotion-end-date'],
                'relationship-status'  => (int)$voucher['relationship-status'],
                'language'             => $voucher['language'],  
            ];

            $this->db->replace($this->table_voucher_name, $attr);
        }
    }
}

如果我回显这三个参数之一,则应该获取每个凭单的日期,但我会得到类似这样的信息:

  

ArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArray2018-04-16 19:47:00.0ArrayArrayArrayArrayArrayArrayArray-04-2018 :00.0ArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArray

只有一些凭证有日期,因此只有少数我可以通过这种方式将其导入数据库。怎么了?

0 个答案:

没有答案