|
|
|
@ -2,6 +2,7 @@ |
|
|
|
|
namespace app\controller; |
|
|
|
|
|
|
|
|
|
use app\BaseController; |
|
|
|
|
use app\model\RepeatFrameT; |
|
|
|
|
use library\Tree; |
|
|
|
|
use think\facade\Db; |
|
|
|
|
use think\response\Json; |
|
|
|
@ -147,6 +148,28 @@ class Repeat extends BaseController |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function recovery($id) |
|
|
|
|
{ |
|
|
|
|
if(Db::table('repeat_data_t')->where('repeat_id', $id)->count() == 0) { |
|
|
|
|
$this->json_data['code'] = 0; |
|
|
|
|
$this->json_data['msg'] = '当前批次没有可恢复数量'; |
|
|
|
|
return json($this->json_data); |
|
|
|
|
} |
|
|
|
|
Db::startTrans(); |
|
|
|
|
try { |
|
|
|
|
Db::query("insert into car_info_t( `id`, `register_date`, `car_man`, `car_number`, `car_phone`, `car_frame_no`, `car_no`, `engine_no`, `factory_model`, `purchase_price`, `company`, `insurer1_date`, `insurer2_date`, `id_man`, `id_number`, `id_phone`, `insured_man`, `insured_number`, `insured_phone`, `link_man_1`, `link_phone_1`, `link_man_2`, `link_phone_2`, `link_man_3`, `link_phone_3`, `is_delete`, `source`, `is_export_bhx`, `is_export_bmc`, `is_export_failed`, `is_export_none_bmc`, `is_update_bhx`, `create_timestamp`, `update_timestamp`, `is_export_failed_bmc`, `tag`) |
|
|
|
|
select `id`, `register_date`, `car_man`, `car_number`, `car_phone`, `car_frame_no`, `car_no`, `engine_no`, `factory_model`, `purchase_price`, `company`, `insurer1_date`, `insurer2_date`, `id_man`, `id_number`, `id_phone`, `insured_man`, `insured_number`, `insured_phone`, `link_man_1`, `link_phone_1`, `link_man_2`, `link_phone_2`, `link_man_3`, `link_phone_3`, `is_delete`, `source`, `is_export_bhx`, `is_export_bmc`, `is_export_failed`, `is_export_none_bmc`, `is_update_bhx`, `create_timestamp`, `update_timestamp`, `is_export_failed_bmc`, `tag` from repeat_data_t where repeat_id=:id;", |
|
|
|
|
['id' => $id]); |
|
|
|
|
RepeatFrameT::where('repeat_data_t', $id)->delete(); |
|
|
|
|
Db::commit(); |
|
|
|
|
} catch (\Exception $e) { |
|
|
|
|
Db::rollback(); |
|
|
|
|
$this->json_data['code'] = 0; |
|
|
|
|
$this->json_data['msg'] = '恢复失败: '. $e->getMessage(); |
|
|
|
|
} |
|
|
|
|
return json($this->json_data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param $params |
|
|
|
|
* @return array |
|
|
|
|