|
@@ -76,8 +76,8 @@ class LogisticsController extends AdminBaseController |
|
@@ -76,8 +76,8 @@ class LogisticsController extends AdminBaseController |
76
|
$array = $this->import_excel('./upload/'.$excel);
|
76
|
$array = $this->import_excel('./upload/'.$excel);
|
77
|
//执行导入操作
|
77
|
//执行导入操作
|
78
|
Db::startTrans();
|
78
|
Db::startTrans();
|
79
|
- $t = 24 * 60 * 60;
|
|
|
80
|
foreach ($array as $k=>$v) {
|
79
|
foreach ($array as $k=>$v) {
|
|
|
80
|
+ $insert = $update = [];
|
81
|
// if(!$this->logistics_model->check($v[1])) {
|
81
|
// if(!$this->logistics_model->check($v[1])) {
|
82
|
$insert['mobile'] = $update['mobile'] = $v[0];
|
82
|
$insert['mobile'] = $update['mobile'] = $v[0];
|
83
|
$insert['send_time'] = $update['send_time'] = date('Y-m-d H:i:s',\PHPExcel_Shared_Date::ExcelToPHP($v[1]));
|
83
|
$insert['send_time'] = $update['send_time'] = date('Y-m-d H:i:s',\PHPExcel_Shared_Date::ExcelToPHP($v[1]));
|
|
@@ -86,12 +86,19 @@ class LogisticsController extends AdminBaseController |
|
@@ -86,12 +86,19 @@ class LogisticsController extends AdminBaseController |
86
|
$insert['is_del'] = $update['is_del'] = $v[4];
|
86
|
$insert['is_del'] = $update['is_del'] = $v[4];
|
87
|
if(empty($v[4])) {
|
87
|
if(empty($v[4])) {
|
88
|
$insert['is_del'] = $update['is_del'] = 0;
|
88
|
$insert['is_del'] = $update['is_del'] = 0;
|
|
|
89
|
+ if($v[4] == 0) {
|
|
|
90
|
+ $update['delete_time'] = 0;
|
|
|
91
|
+ $insert['is_del'] = $update['is_del'] = 0;
|
|
|
92
|
+ }
|
|
|
93
|
+ } else{
|
|
|
94
|
+ if($v[4] == 1) {
|
|
|
95
|
+ $update['delete_time'] = time();
|
|
|
96
|
+ $update['is_del'] = 1;
|
|
|
97
|
+ }
|
89
|
}
|
98
|
}
|
90
|
$info = $this->logistics_model->where(['express'=>$insert['express']])->find();
|
99
|
$info = $this->logistics_model->where(['express'=>$insert['express']])->find();
|
91
|
if($info) {
|
100
|
if($info) {
|
92
|
- $update['id'] = $info['id'];
|
|
|
93
|
- $update['update_time'] = time();
|
|
|
94
|
- if(!$this->logistics_model->editLogistics($update)) {
|
101
|
+ if(!$this->logistics_model->where(['id'=>$info['id']])->update($update)) {
|
95
|
Db::rollback();
|
102
|
Db::rollback();
|
96
|
$this->error('数据导入中出错,请重试');
|
103
|
$this->error('数据导入中出错,请重试');
|
97
|
}
|
104
|
}
|
|
@@ -266,10 +273,10 @@ class LogisticsController extends AdminBaseController |
|
@@ -266,10 +273,10 @@ class LogisticsController extends AdminBaseController |
266
|
$id = $this->request->param('id',0,'intval');
|
273
|
$id = $this->request->param('id',0,'intval');
|
267
|
$ids = $this->request->param('ids/a');
|
274
|
$ids = $this->request->param('ids/a');
|
268
|
if(isset($id)) {
|
275
|
if(isset($id)) {
|
269
|
- $result = $this->logistics_model->where(['id'=>$id])->update(['delete_time'=>time()]);
|
276
|
+ $result = $this->logistics_model->where(['id'=>$id])->update(['delete_time'=>time(),'is_del'=>1]);
|
270
|
}
|
277
|
}
|
271
|
if(isset($ids)) {
|
278
|
if(isset($ids)) {
|
272
|
- $result = $this->logistics_model->where(['id'=>['in',$ids]])->update(['delete_time'=>time()]);
|
279
|
+ $result = $this->logistics_model->where(['id'=>['in',$ids]])->update(['delete_time'=>time(),'is_del'=>1]);
|
273
|
}
|
280
|
}
|
274
|
if(!$result) {
|
281
|
if(!$result) {
|
275
|
$this->error('删除失败');
|
282
|
$this->error('删除失败');
|