You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.8 KiB
PHP

<?php
namespace Admin\Model;
use Think\Model;
class PartnerVerifyModel extends Model
{
protected $tablePrefix = 'tab_';
public $VerifyStatus=[
"-1"=>"审核拒绝",
"0"=>"未审核",
"1"=>"审核通过"
];
public function getVerifyCompanyInfo($id)
{
}
/**
* 新增
* @param [array]] $partner_info 公司信息
* @return void
*/
public function add_db($partner_info)
{
$verifydata = [
"partner_id"=>0,
"partner_name"=>$partner_info['partner'],
"verify_status"=>0,
"create_time"=>time(),
'verify_log'=>json_encode(["create_user"=>$_SESSION['onethink_admin']['user_auth']['username'],"create_time"=>date("Y-m-d H:i:s")])
];
$verifydata['partner_info'] = json_encode($partner_info,JSON_UNESCAPED_UNICODE);
return $this->add($verifydata);
}
public function edit_db($partner_info)
{
if(!isset($partner_info['id'])){
return false;
}
$p_id = $partner_info['id'];
$verifydata = [
"partner_id"=>$p_id,
"partner_name"=>$partner_info['partner'],
"verify_status"=>0,
"create_time"=>time(),
'verify_log'=>json_encode(["create_user"=>$_SESSION['onethink_admin']['user_auth']['username'],"create_time"=>date("Y-m-d H:i:s")])
];
$verifydata['partner_info'] = json_encode($partner_info,JSON_UNESCAPED_UNICODE);
//判断是否存在
$has = $this->where("partner_id = {$p_id}")->find();
if($has){
//存在
$verifydata['id'] = $has['id'];
$res = $this->save($verifydata);
}else{
$res = $this->add($verifydata);
}
return $res;
}
}