Files
pgserver3.0/pgserver/application/model/BocPreapply.php
annnj-company 130c1026c4 first commit
2026-04-17 18:29:53 +08:00

90 lines
3.3 KiB
PHP

<?php
namespace app\model;
use think\Db;
use think\db\Where;
class BocPreapply extends Base
{
/**
* 获取中国银行预评估申请列表
* @Author llz
* @DateTime 2022-11-23
* @version 2.0
* @param array $field 查询字段值
* @param array $where 查询条件
* @param array $paginate 分页设置
* @return array
*/
public function getPreApplyList($page,$limit, $handle_status, $keyword ){
$paginate = [
'list_rows' => $limit,
'page' => $page
];
$where = "";
if($keyword != '') {
$where = $where." bank_pre_estimate_no like '%".$keyword."%'"." or property_name like '%".$keyword."%'"." or banker_name like '%".$keyword."%'";
}
if($handle_status != 'all') {
$where = $where.($where!=""?' and ':"")." handle_status = '".$handle_status."'";
}
/*else {
$where = $where.($where!=""?' and ':"")." handle_status <> 2'";
}*/
$res = Db::name('boc_preapply')
->field('*,if(update_time,update_time,create_time) as time')
->order("time","desc")
->where($where)
->paginate($paginate);
// ->limit($limit);
$total = $res->total()?$res->total():0;
$res = ['total'=>$total,'data'=>$res->toArray()];
return $res;
}
public function updatePreapplyStatus($bankPreEstimateNo,$status) {
$res = Db::name('boc_preapply')->where('bank_pre_estimate_no', $bankPreEstimateNo)
->update(['handle_status' => $status]);
}
public function addPreapply(array $data){
Db::startTrans();
$this->bank_pre_estimate_no = $data['bankPreEstimateNo'];
$this->banker_branch = trim($data['bankerBranch']);
$this->banker_name = $data['bankerName'];
$this->banker_phone = $data['bankerPhone'];
$this->callback_url = $data['callBackUrl'];
$this->company_code = $data['companyCode'];
$this->is_return_report = $data['isReturnReport'];
$this->postscript = $data['postscript'];
$this->assessment_type = $data['assessmentType'];
$this->handle_status = '0';
$fileType = json_decode($data['propertyCardType']);
$filename = $data['bankPreEstimateNo'] . "." . $fileType[0];
$this->property_card = $filename;
$fileDataArray = json_decode($data['propertyCard']);
$fileData = base64_decode($fileDataArray[0]);
$filename = "C:\\phpstudy_pro\\WWW\\PGEvaSysVue\\" . $filename;
file_put_contents($filename,$fileData);//写入文件并保存
$this->property_card_type = $fileType;
$this->property_name = $data['propertyName'];
$this->request_number = $data['requestNumber'];
$this->system_remark = $data['systemRemark'];
$this->timestamp = time();//date('Y-m-d H:i:s',$data['timestamp']/1000);
$this->create_time = date('Y-m-d H:i:s');
$this->update_time = date('Y-m-d H:i:s');
if (!$this->save()){
Db::rollback();
return false;
}
Db::commit();
return true;
}
}
?>