redirect("https://anti-fake-checking.com/index"); return $this->view->fetch(); } public function sn_result() { if ($_POST) { $post = $this->request->post(); //$this->verify_check($post['captcha'], 'authcode') || $this->error('验证码有误', url('antifake/index')); $snnum = $post['sn']; $snnum = str_replace('-','',$snnum); $ssd = Loader::model('Ssd'); $where = ['sn' => $post['sn']]; $arr = $ssd->where($where)->find(); if ($arr) { $data = $arr;//dump($data['sn']);die; $data['result'] = 1; $this->assign('data', $data); } else { $postdata = ['sn'=>$snnum]; $postdata = http_build_query($postdata); $sn = CurlRequest('http://mes.orico.com.cn:8081/content/mes/web/api/fwm.aspx', $postdata); $sn = json_decode($sn, true); if ($sn['result'] == 1) { $data['sn'] = $post['sn']; $data['fake'] = ''; $data['specifications_and_models'] = $sn['specifications_and_models']; $data['69_code'] = $sn['69_code']; $data['production_date'] = $sn['production_date']; $data['Customer_name'] = $sn['Customer_name']; if($sn['delivery_time']){ $data['delivery_time'] = $sn['delivery_time']; } //$data['department'] = $sn['B2B_B2C']; $data['made_up_articles_name'] = $sn['made_up_articles_name']; $data['chicktime'] = date("Y-m-d H:i:s"); //$time = strtotime($data['delivery_time']); // $data['mendtime'] = date('Y-m-d H:i:s', strtotime("+5year", $time)); //if($data['department']=='B2B'){ //$data['mendtime'] = date('Y-m-d H:i:s', strtotime("+1 month",strtotime($data['mendtime']))); //} $data['material_ID'] = $sn['material_ID']; $where = ['sku'=>$data['specifications_and_models']]; $productid = Loader::model('ProductSku')->where($where)->find(); $img = Loader::model('product_two_img')->where(['product_id'=>$productid['product_id']])->find(); $img = $img['image_url']; $data['img']=$img; $add = $ssd->save($data); $data['result'] = $sn['result']; $this->assign('data',$data); } else { $data['sn']=$snnum; $data['result'] = $sn['result']; $this->assign('data',$data); } } } return $this->fetch(); } public function anti_fake_result() { if ($_POST) { $post = $this->request->post(); //$verify = $this->verify_check($post['captcha'], 'authcode'); || $this->error('验证码有误', url('antifake/index')); $fake = $post['fake']; $ssd = Loader::model('Ssd'); $where = ['fake' => $fake]; $arr = $ssd->where($where)->find(); //echo "
=="; print_r($post); die;
            if ($arr) {
                $data           = $arr;//dump($data['sn']);die;
                $data['result'] = 1;
                $this->assign('data', $data);
            } else {
                $postdata = ['fwm'=>$fake];
                $postdata = http_build_query($postdata);
                $sn = CurlRequest('http://mes.orico.com.cn:8081/content/mes/web/api/fwm.aspx', $postdata);
                $sn = json_decode($sn, true);
                if ($sn['result'] == 1) {
                    $data['sn']                        = $sn['serial_number'];
                    $data['fake']                      = $fake;
                    $data['specifications_and_models'] = $sn['specifications_and_models'];
                    $data['69_code']                   = $sn['69_code'];
                    $data['production_date']           = $sn['production_date'];
                    $data['Customer_name']       = $sn['Customer_name'];
                    $data['delivery_time']       = $sn['delivery_time'];
                    //$data['department']       = $sn['B2B_B2C'];
                    $data['made_up_articles_name']     = $sn['made_up_articles_name'];
                    $data['chicktime']                 = date("Y-m-d H:i:s");
                    $time                              = strtotime($data['delivery_time']);
                    $data['mendtime']                  = date('Y-m-d H:i:s', strtotime("+5year", $time));
                    //if($data['department']=='B2B'){
                        $data['mendtime'] = date('Y-m-d H:i:s', strtotime("+1 month",strtotime($data['mendtime'])));
                   // }
                    $data['material_ID']       = $sn['material_ID'];

                    $where = ['sku'=>$data['specifications_and_models']];
                    $productid = Loader::model('product_sku')->where($where)->find();
                    $img = Loader::model('product_two_img')->where(['product_id'=>$productid['product_id']])->find();
                    $img = $img['image_url'];
                    $data['img']=$img;
                    $add                               = $ssd->save($data);
                    $data['result'] = $sn['result'];
                    $this->assign('data',$data);
                } else {
                    $data['fake']=$fake;
                    $data['result'] = $sn['result'];
                    $this->assign('data',$data);
                }
            }
        }
        return $this->fetch();

    }
}