...
|
...
|
@@ -76,8 +76,8 @@ class LogisticsController extends AdminBaseController |
|
|
$array = $this->import_excel('./upload/'.$excel);
|
|
|
//执行导入操作
|
|
|
Db::startTrans();
|
|
|
$t = 24 * 60 * 60;
|
|
|
foreach ($array as $k=>$v) {
|
|
|
$insert = $update = [];
|
|
|
// if(!$this->logistics_model->check($v[1])) {
|
|
|
$insert['mobile'] = $update['mobile'] = $v[0];
|
|
|
$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 |
|
|
$insert['is_del'] = $update['is_del'] = $v[4];
|
|
|
if(empty($v[4])) {
|
|
|
$insert['is_del'] = $update['is_del'] = 0;
|
|
|
if($v[4] == 0) {
|
|
|
$update['delete_time'] = 0;
|
|
|
$insert['is_del'] = $update['is_del'] = 0;
|
|
|
}
|
|
|
} else{
|
|
|
if($v[4] == 1) {
|
|
|
$update['delete_time'] = time();
|
|
|
$update['is_del'] = 1;
|
|
|
}
|
|
|
}
|
|
|
$info = $this->logistics_model->where(['express'=>$insert['express']])->find();
|
|
|
if($info) {
|
|
|
$update['id'] = $info['id'];
|
|
|
$update['update_time'] = time();
|
|
|
if(!$this->logistics_model->editLogistics($update)) {
|
|
|
if(!$this->logistics_model->where(['id'=>$info['id']])->update($update)) {
|
|
|
Db::rollback();
|
|
|
$this->error('数据导入中出错,请重试');
|
|
|
}
|
...
|
...
|
@@ -266,10 +273,10 @@ class LogisticsController extends AdminBaseController |
|
|
$id = $this->request->param('id',0,'intval');
|
|
|
$ids = $this->request->param('ids/a');
|
|
|
if(isset($id)) {
|
|
|
$result = $this->logistics_model->where(['id'=>$id])->update(['delete_time'=>time()]);
|
|
|
$result = $this->logistics_model->where(['id'=>$id])->update(['delete_time'=>time(),'is_del'=>1]);
|
|
|
}
|
|
|
if(isset($ids)) {
|
|
|
$result = $this->logistics_model->where(['id'=>['in',$ids]])->update(['delete_time'=>time()]);
|
|
|
$result = $this->logistics_model->where(['id'=>['in',$ids]])->update(['delete_time'=>time(),'is_del'=>1]);
|
|
|
}
|
|
|
if(!$result) {
|
|
|
$this->error('删除失败');
|
...
|
...
|
|