366 lines
18 KiB
PHP
Executable File
366 lines
18 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: ORICO
|
|
* Date: 2019-07-25
|
|
* Time: 11:43
|
|
*/
|
|
|
|
namespace app\usmobile\controller;
|
|
use think\Loader;
|
|
use think\Cookie;
|
|
use think\Config;
|
|
use think\validate;
|
|
|
|
class Antifake extends BaseController
|
|
{
|
|
public function anti_fake_inlet()
|
|
{
|
|
$this->redirect("https://anti-fake-checking.com/index");
|
|
return $this->view->fetch();
|
|
}
|
|
public function anti_fake()
|
|
{
|
|
$this->redirect("https://anti-fake-checking.com/index");
|
|
return $this->view->fetch();
|
|
}
|
|
public function index()
|
|
{
|
|
$this->redirect("https://anti-fake-checking.com/index");
|
|
return $this->view->fetch();
|
|
}
|
|
public function anti_fake_sninput()
|
|
{
|
|
$this->redirect("https://anti-fake-checking.com/index");
|
|
return $this->view->fetch();
|
|
}
|
|
public function anti_fake_input()
|
|
{
|
|
$this->redirect("https://anti-fake-checking.com/index");
|
|
return $this->view->fetch();
|
|
}
|
|
|
|
|
|
|
|
public function anti_fake_scan_snresult()
|
|
{
|
|
if ($_GET) {
|
|
$post = $this->request->get();
|
|
$fake = $post['qrresult'];
|
|
$fake = substr($fake,'7');
|
|
$ssd = Loader::model('Ssd');
|
|
$where = ['sn' => $fake];
|
|
$arr = $ssd->where($where)->find();
|
|
if ($arr) {
|
|
$data = $arr;//dump($data['sn']);die;
|
|
$data['result'] = 1;
|
|
$this->assign('data', $data);
|
|
} else {
|
|
$sn = https_request('http://mes.orico.com.cn:8084/api/SN/', $fake);
|
|
$sn = json_decode($sn, true);
|
|
$sn = json_decode($sn, true);//dump($sn);die;
|
|
if ($sn['result'] == 1) {
|
|
$data['sn'] = $sn['serial_number'];
|
|
$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'];
|
|
$data['delivery_time'] = $sn['delivery_time'];
|
|
$data['department'] = $sn['department'];
|
|
$data['made_up_articles_name'] = $sn['made_up_articles_name'];
|
|
$data['chicktime'] = date("Y-m-d H:i:s");
|
|
|
|
if (strpos($data['made_up_articles_name'], 'NGFF') !== false) {
|
|
$data['aditmend'] = 5;
|
|
|
|
if($sn['delivery_time']){
|
|
$data['delivery_time'] = $sn['delivery_time'];
|
|
$time = strtotime($data['delivery_time']);
|
|
$data['mendtime'] = date('Y-m-d H:i:s', strtotime("+5year", $time));
|
|
}
|
|
else{
|
|
$data['delivery_time'] = '';
|
|
}
|
|
}
|
|
elseif(strpos($data['made_up_articles_name'], 'NVME') !== false){
|
|
$data['aditmend'] = 3;
|
|
if($sn['delivery_time']){
|
|
$data['delivery_time'] = $sn['delivery_time'];
|
|
$time = strtotime($data['delivery_time']);
|
|
$data['mendtime'] = date('Y-m-d H:i:s', strtotime("+3year", $time));
|
|
}
|
|
else{
|
|
$data['delivery_time'] = '';
|
|
}
|
|
}
|
|
//$time = strtotime($data['delivery_time']);
|
|
/*$data['mendtime'] = date('Y-m-d H:i:s', strtotime("+5year", $time));
|
|
$bm = ['速卖通运营部','速卖通运营部','美国新蛋','海外亚马逊','ODM项目部','子品牌事业部','B2B营销中心','海外渠道部'];
|
|
if(in_array($data['department'],$bm)){
|
|
$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['sn']=$fake;
|
|
$data['result'] = $sn['result'];
|
|
$this->assign('data',$data);
|
|
}
|
|
}
|
|
}
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
public function anti_fake_scan_result()
|
|
{
|
|
if ($_GET) {
|
|
$post = $this->request->get();
|
|
$fake = $post['qrresult'];
|
|
$ssd = Loader::model('Ssd');
|
|
$where = ['fake' => $fake];
|
|
$arr = $ssd->where($where)->find();
|
|
if ($arr) {
|
|
$data = $arr;//dump($data['sn']);die;
|
|
$data['result'] = 1;
|
|
$this->assign('data', $data);
|
|
} else {
|
|
$sn = https_request('http://mes.orico.com.cn:8084/api/values/', $fake);
|
|
$sn = json_decode($sn, true);
|
|
$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['department'];
|
|
$data['made_up_articles_name'] = $sn['made_up_articles_name'];
|
|
$data['chicktime'] = date("Y-m-d H:i:s");
|
|
|
|
if (strpos($data['made_up_articles_name'], 'NGFF') !== false) {
|
|
$data['aditmend'] = 5;
|
|
|
|
if($sn['delivery_time']){
|
|
$data['delivery_time'] = $sn['delivery_time'];
|
|
$time = strtotime($data['delivery_time']);
|
|
$data['mendtime'] = date('Y-m-d H:i:s', strtotime("+5year", $time));
|
|
}
|
|
else{
|
|
$data['delivery_time'] = '';
|
|
}
|
|
}
|
|
elseif(strpos($data['made_up_articles_name'], 'NVME') !== false){
|
|
$data['aditmend'] = 3;
|
|
if($sn['delivery_time']){
|
|
$data['delivery_time'] = $sn['delivery_time'];
|
|
$time = strtotime($data['delivery_time']);
|
|
$data['mendtime'] = date('Y-m-d H:i:s', strtotime("+3year", $time));
|
|
}
|
|
else{
|
|
$data['delivery_time'] = '';
|
|
}
|
|
}
|
|
|
|
/* $time = strtotime($data['delivery_time']);
|
|
$data['mendtime'] = date('Y-m-d H:i:s', strtotime("+5year", $time));
|
|
$bm = ['速卖通运营部','速卖通运营部','美国新蛋','海外亚马逊','ODM项目部','子品牌事业部','B2B营销中心','海外渠道部'];
|
|
if(in_array($data['department'],$bm)){
|
|
$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();
|
|
|
|
}
|
|
public function anti_fake_snresult()
|
|
{
|
|
if ($_POST) {
|
|
$post = $this->request->post();
|
|
if($post['sn']==''){
|
|
$this->error('请输入SN码');
|
|
}
|
|
//$this->verify_check($post['captcha'], 'authcode') || $this->error('验证码有误', url('fake/index'));
|
|
$snnum = $post['sn'];
|
|
$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 {
|
|
$sn = https_request('http://mes.orico.com.cn:8084/api/SN/', $snnum);
|
|
$sn = json_decode($sn, true);
|
|
$sn = json_decode($sn, true);
|
|
if ($sn['result'] == 1) {
|
|
$data['sn'] = $sn['serial_number'];
|
|
$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'];
|
|
$data['delivery_time'] = $sn['delivery_time'];
|
|
$data['department'] = $sn['department'];
|
|
$data['made_up_articles_name'] = $sn['made_up_articles_name'];
|
|
$data['chicktime'] = date("Y-m-d H:i:s");
|
|
|
|
if (strpos($data['made_up_articles_name'], 'NGFF') !== false) {
|
|
$data['aditmend'] = 5;
|
|
|
|
if($sn['delivery_time']){
|
|
$data['delivery_time'] = $sn['delivery_time'];
|
|
$time = strtotime($data['delivery_time']);
|
|
$data['mendtime'] = date('Y-m-d H:i:s', strtotime("+5year", $time));
|
|
}
|
|
else{
|
|
$data['delivery_time'] = '';
|
|
}
|
|
}
|
|
elseif(strpos($data['made_up_articles_name'], 'NVME') !== false){
|
|
$data['aditmend'] = 3;
|
|
if($sn['delivery_time']){
|
|
$data['delivery_time'] = $sn['delivery_time'];
|
|
$time = strtotime($data['delivery_time']);
|
|
$data['mendtime'] = date('Y-m-d H:i:s', strtotime("+3year", $time));
|
|
}
|
|
else{
|
|
$data['delivery_time'] = '';
|
|
}
|
|
}
|
|
|
|
/*$time = strtotime($data['delivery_time']);
|
|
$data['mendtime'] = date('Y-m-d H:i:s', strtotime("+5year", $time));
|
|
$bm = ['速卖通运营部','速卖通运营部','美国新蛋','海外亚马逊','ODM项目部','子品牌事业部','B2B营销中心','海外渠道部'];
|
|
if(in_array($data['department'],$bm)){
|
|
$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['sn']=$snnum;
|
|
$data['result'] = $sn['result'];
|
|
$this->assign('data',$data);
|
|
}
|
|
}
|
|
}
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
public function anti_fake_result()
|
|
{
|
|
if ($_POST) {
|
|
$post = $this->request->post();
|
|
if($post['fake']==''){
|
|
$this->error('请输入防伪码');
|
|
}
|
|
//$this->verify_check($post['captcha'], 'authcode') || $this->error('验证码有误', url('fake/index'));
|
|
$fake = $post['fake'];
|
|
$ssd = Loader::model('Ssd');
|
|
$where = ['fake' => $fake];
|
|
$arr = $ssd->where($where)->find();
|
|
if ($arr) {
|
|
$data = $arr;//dump($data['sn']);die;
|
|
$data['result'] = 1;
|
|
$this->assign('data', $data);
|
|
} else {
|
|
$sn = https_request('http://mes.orico.com.cn:8084/api/values/', $fake);
|
|
$sn = json_decode($sn, true);
|
|
$sn = json_decode($sn, true);//dump($sn);die;
|
|
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['department'];
|
|
$data['made_up_articles_name'] = $sn['made_up_articles_name'];
|
|
$data['chicktime'] = date("Y-m-d H:i:s");
|
|
|
|
if (strpos($data['made_up_articles_name'], 'NGFF') !== false) {
|
|
$data['aditmend'] = 5;
|
|
|
|
if($sn['delivery_time']){
|
|
$data['delivery_time'] = $sn['delivery_time'];
|
|
$time = strtotime($data['delivery_time']);
|
|
$data['mendtime'] = date('Y-m-d H:i:s', strtotime("+5year", $time));
|
|
}
|
|
else{
|
|
$data['delivery_time'] = '';
|
|
}
|
|
}
|
|
elseif(strpos($data['made_up_articles_name'], 'NVME') !== false){
|
|
$data['aditmend'] = 3;
|
|
if($sn['delivery_time']){
|
|
$data['delivery_time'] = $sn['delivery_time'];
|
|
$time = strtotime($data['delivery_time']);
|
|
$data['mendtime'] = date('Y-m-d H:i:s', strtotime("+3year", $time));
|
|
}
|
|
else{
|
|
$data['delivery_time'] = '';
|
|
}
|
|
}
|
|
/*$time = strtotime($data['delivery_time']);
|
|
$data['mendtime'] = date('Y-m-d H:i:s', strtotime("+5year", $time));
|
|
$bm = ['速卖通运营部','速卖通运营部','美国新蛋','海外亚马逊','ODM项目部','子品牌事业部','B2B营销中心','海外渠道部'];
|
|
if(in_array($data['department'],$bm)){
|
|
$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();
|
|
|
|
}
|
|
} |