|
@@ -83,7 +83,8 @@ class ProcessDocument extends Api
|
|
|
$where = array();
|
|
$where = array();
|
|
|
//印件代号
|
|
//印件代号
|
|
|
$where['product_number'] = $params['yjdh'];
|
|
$where['product_number'] = $params['yjdh'];
|
|
|
- $res = Db::connect('db2')->name('qr_history')->where($where)->order('id desc')->field('data,update')->find();
|
|
|
|
|
|
|
+ $db2 = \db()->connect(config('database.db2'));
|
|
|
|
|
+ $res = $db2->name('qr_history')->where($where)->order('id desc')->field('data,update')->find();
|
|
|
$result = array();
|
|
$result = array();
|
|
|
$result['update'] = '暂无';
|
|
$result['update'] = '暂无';
|
|
|
$result['data'] = '';
|
|
$result['data'] = '';
|
|
@@ -112,6 +113,7 @@ class ProcessDocument extends Api
|
|
|
if (empty($params['order'])){
|
|
if (empty($params['order'])){
|
|
|
$this->error('参数不能为空');
|
|
$this->error('参数不能为空');
|
|
|
}
|
|
}
|
|
|
|
|
+ $db2 = \db()->connect(config('database.db2'));
|
|
|
$ip = request()->ip();
|
|
$ip = request()->ip();
|
|
|
//定义各部门ip地址
|
|
//定义各部门ip地址
|
|
|
$JYarray=array('20.0.3.253','60.190.242.28','127.0.0.1');
|
|
$JYarray=array('20.0.3.253','60.190.242.28','127.0.0.1');
|
|
@@ -134,11 +136,11 @@ class ProcessDocument extends Api
|
|
|
$map['product_number'] = $data['product_number'];
|
|
$map['product_number'] = $data['product_number'];
|
|
|
$data['update'] = date('Y-m-d H:i:s');
|
|
$data['update'] = date('Y-m-d H:i:s');
|
|
|
$data['ip'] =$ip;
|
|
$data['ip'] =$ip;
|
|
|
- $isNull = Db::connect('db2')->name('qr_history')->where($map)->find();
|
|
|
|
|
|
|
+ $isNull = $db2->name('qr_history')->where($map)->find();
|
|
|
if ($isNull){//去更新工艺及时间
|
|
if ($isNull){//去更新工艺及时间
|
|
|
- $res = Db::connect('db2')->name('qr_history')->where('id',$isNull['id'])->update($data);
|
|
|
|
|
|
|
+ $res = $db2->name('qr_history')->where('id',$isNull['id'])->update($data);
|
|
|
}else{//新增
|
|
}else{//新增
|
|
|
- $res = Db::connect('db2')->name('qr_history')->insert($data);
|
|
|
|
|
|
|
+ $res = $db2->name('qr_history')->insert($data);
|
|
|
}
|
|
}
|
|
|
if ($res){
|
|
if ($res){
|
|
|
$this->success('更新成功');
|
|
$this->success('更新成功');
|