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.
77 lines
2.3 KiB
PHP
77 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace Admin\Model;
|
|
|
|
use Think\Model;
|
|
|
|
class PromoteCompanyVerifyModel extends Model
|
|
{
|
|
protected $tablePrefix = 'tab_';
|
|
public $VerifyStatus=[
|
|
"-2"=>"管理员审核拒绝",
|
|
"-1"=>"市场部审核拒绝",
|
|
"0"=>"未审核",
|
|
"1"=>"市场部审核通过",
|
|
"2"=>"管理员审核通过"
|
|
];
|
|
/**
|
|
* 新增
|
|
* @param [array]] $info 公司信息
|
|
* @return void
|
|
*/
|
|
public function add_db($info)
|
|
{
|
|
$verifydata = [
|
|
"company_id"=>0,
|
|
"company_name"=>$info['company_name'],
|
|
"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")])
|
|
];
|
|
if(isset($info['instanceof'])) unset($info['instanceof']);
|
|
if(isset($info['turnover'])) unset($info['turnover']);
|
|
$verifydata['company_info'] = json_encode($info,JSON_UNESCAPED_UNICODE);
|
|
$id = $this->add($verifydata);
|
|
if ($id) {
|
|
$verifydata['id'] = $id;
|
|
return $verifydata;
|
|
}
|
|
return null;
|
|
}
|
|
public function edit_db($info)
|
|
{
|
|
if(!isset($info['id'])){
|
|
return false;
|
|
}
|
|
$p_id = $info['id'];
|
|
|
|
$verifydata = [
|
|
"company_id"=>$p_id,
|
|
"company_name"=>$info['company_name'],
|
|
"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")])
|
|
];
|
|
if(isset($info['instanceof'])) unset($info['instanceof']);
|
|
if(isset($info['turnover'])) unset($info['turnover']);
|
|
$verifydata['company_info'] = json_encode($info,JSON_UNESCAPED_UNICODE);
|
|
|
|
//判断是否存在
|
|
$has = $this->where("company_id = {$p_id}")->find();
|
|
$res = null;
|
|
if($has){
|
|
//存在
|
|
$verifydata['id'] = $has['id'];
|
|
$res = $this->save($verifydata);
|
|
}else{
|
|
$res = $this->add($verifydata);
|
|
$verifydata['id'] = $res;
|
|
}
|
|
if ($res) {
|
|
return $verifydata;
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
} |