You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
911 B
39 lines
911 B
<?php
|
|
|
|
namespace app\model;
|
|
|
|
use think\Model;
|
|
|
|
class InvoiceHead extends Model
|
|
{
|
|
|
|
public static $typeArr = ['单位', '个人'];
|
|
|
|
public static function createHead($wechat_user_id, $data)
|
|
{
|
|
|
|
$param = [
|
|
'type' => $data['type'],
|
|
'title' => $data['title'],
|
|
'tax_number' => $data['tax_number'],
|
|
'wechat_user_id' => $wechat_user_id
|
|
];
|
|
|
|
$id = self::where($param)->value('id');
|
|
if ($id) {
|
|
return $id;
|
|
}
|
|
|
|
$param['address'] = $data['address'] ?? '';
|
|
$param['telephone'] = $data['telephone'] ?? '';
|
|
$param['bank_name'] = $data['bank_name'] ?? '';
|
|
$param['bank_account'] = $data['bank_account'] ?? '';
|
|
$param['create_time'] = time();
|
|
|
|
|
|
$model = self::create($param);
|
|
|
|
return $model->where($param)->value('id');
|
|
}
|
|
|
|
}
|