<?php
/**
 *
 * @author：llbjj
 * @DateTime：2022/5/6 10:57
 * @Description：
 *
 */

namespace Application\Service\DB\Item;

use Interop\Container\ContainerInterface;

class Imgtxtdiscern extends \Application\Service\DB\AbstractDb
{
    public function __construct($dbAdapter, ContainerInterface $container)
    {
        $this->tableName = 'yikeen_item_imgtxtdiscern';
        parent::__construct($dbAdapter, $container);
    }
    public function copyOcr($newData)
    {
        $itemsig_id = $newData['itemsig_id'];
        $target_itemsig_id = $newData['target_itemsig_id'];
        $item_id = $newData['item_id'];

        //查询当前中心OCR模板数据
        $datas= $this->fetchAll([
            'where'=> [
                'item_id' => $item_id,
                'item_sig_id' => $target_itemsig_id,
                'is_del' => 0,
            ],
            'columns'=>['item_id','ocr_id','category_id','check_data']
        ]);
        //存入目标中心
        if(!empty($datas)){
            foreach($datas as $k=>$v){
                $v['item_sign_id'] = $itemsig_id;
                $result = $this->insert($v);
                if (!empty($result)) $this->LocalService()->log->saveFileLog($result,'itemImgtxtdiscern',$v ,0, '', $v['item_id'], 'sigOcrForm');
            }
        }
        return true;
    }

}