公司录入

master
sk 5 years ago
parent 0fba64c6f1
commit ce9faf7271

@ -85,10 +85,45 @@ class PromoteCompanyController extends ThinkController
if (empty($company_name)) {
$this->error('请输入推广公司名称');
}
if (empty(I('post.settlement_contact'))) {
$this->error('请输入结算联系人');
}
if (empty(I('post.contact_phone'))) {
$this->error('请输入联系人电话');
}
$pattern = "/^1[3|5|7|8]\\d{9}$/i";
if(!preg_match($pattern, I('post.contact_phone'))) {
$this->error("手机号码格式不合法");
return false;
}
if (empty(I('post.address'))) {
$this->error('请输入所在地址');
}
if (empty(I('post.bank_card'))) {
$this->error('请输入银行卡号');
}
$bank_card_pattern = "/^\d{10,19}$/u";
if (!preg_match($bank_card_pattern, I('post.bank_card'))) {
$this->error('卡号格式错误');
return false;
}
if (empty(I('post.bank_cardname'))) {
$this->error('请输入银行卡名');
}
if (empty(I('post.bank_name'))) {
$this->error('请输入收款银行');
}
if (empty(I('post.bank_address'))) {
$this->error('请输入开户网点');
}
if (!in_array($status, [0, 1])) {
$this->error('参数异常');
}
if (!empty(I('post.content'))) {
$save['content'] = I('post.content');
}
$model = M($this->modelName, 'tab_');
$map['company_name'] = $company_name;
$res = $model->where($map)->getField('id');
@ -102,6 +137,13 @@ class PromoteCompanyController extends ThinkController
$save['uid'] = UID;
$save['create_time'] = $time;
$save['last_up_time'] = $time;
$save['settlement_contact'] = I('post.settlement_contact');
$save['contact_phone'] = I('post.contact_phone');
$save['address'] = I('post.address');
$save['bank_card'] = I('post.bank_card');
$save['bank_cardname'] = I('post.bank_cardname');
$save['bank_name'] = I('post.bank_name');
$save['bank_address'] = I('post.bank_address');
$res = $model->add($save);
if ($res) {
@ -130,10 +172,43 @@ class PromoteCompanyController extends ThinkController
if (empty($company_name)) {
$this->error('请输入推广公司名称');
}
if (empty(I('post.settlement_contact'))) {
$this->error('请输入结算联系人');
}
if (empty(I('post.contact_phone'))) {
$this->error('请输入联系人电话');
}
$pattern = "/^1[3|5|7|8]\\d{9}$/i";
if(!preg_match($pattern, I('post.contact_phone'))) {
$this->error("手机号码格式不合法");
return false;
}
if (empty(I('post.address'))) {
$this->error('请输入所在地址');
}
if (empty(I('post.bank_card'))) {
$this->error('请输入银行卡号');
}
$bank_card_pattern = "/^\d{10,19}$/u";
if (!preg_match($bank_card_pattern, I('post.bank_card'))) {
$this->error('卡号格式错误');
return false;
}
if (empty(I('post.bank_cardname'))) {
$this->error('请输入银行卡名');
}
if (empty(I('post.bank_name'))) {
$this->error('请输入收款银行');
}
if (empty(I('post.bank_address'))) {
$this->error('请输入开户网点');
}
if (!in_array($status, [0, 1]) || $id == 0) {
$this->error('参数异常');
}
if (!empty(I('post.content'))) {
$save['content'] = I('post.content');
}
$data = $model->field('id,company_name')->find($id);
if (empty($data)) {
$this->error('数据异常');
@ -150,6 +225,13 @@ class PromoteCompanyController extends ThinkController
$save['company_name'] = $company_name;
$save['status'] = $status;
$save['last_up_time'] = $time;
$save['settlement_contact'] = I('post.settlement_contact');
$save['contact_phone'] = I('post.contact_phone');
$save['address'] = I('post.address');
$save['bank_card'] = I('post.bank_card');
$save['bank_cardname'] = I('post.bank_cardname');
$save['bank_name'] = I('post.bank_name');
$save['bank_address'] = I('post.bank_address');
$res = $model->save($save);
if ($res === false) {
@ -161,7 +243,7 @@ class PromoteCompanyController extends ThinkController
} else {
$id = intval(I('get.id', 0));
$map['id'] = $id;
$data = $model->field('id,company_name,status')->find($id);
$data = $model->field('id,company_name,status,settlement_contact,contact_phone,address,bank_card,bank_cardname,bank_name,bank_address,content')->find($id);
if (empty($data)) {
$this->error('数据异常', U('lists'));
}

@ -35,6 +35,54 @@
<input type="text" class="txt " name="company_name" value="" placeholder="请输入推广公司名称">
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>联系结算人:</td>
<td class="r" >
<input type="text" class="txt " name="settlement_contact" value="" placeholder="请输入结算联系人">
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>联系电话:</td>
<td class="r" >
<input type="text" class="txt " name="contact_phone" value="" placeholder="请输入联系电话">
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>所在地址:</td>
<td class="r" >
<input type="text" class="txt " name="address" value="" placeholder="请输入所在地址">
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>银行卡号:</td>
<td class="r" >
<input type="text" class="txt " name="bank_card" value="" placeholder="请输入银行卡号">
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>银行卡名:</td>
<td class="r" >
<input type="text" class="txt " name="bank_cardname" value="" placeholder="请输入银行卡名">
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>收款银行:</td>
<td class="r" >
<input type="text" class="txt " name="bank_name" value="" placeholder="请输入收款银行">
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>开户网点:</td>
<td class="r" >
<input type="text" class="txt " name="bank_address" value="" placeholder="请输入开户网点">
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px"></i>备注:</td>
<td class="r" >
<input type="text" class="txt " name="content" value="" placeholder="">
</td>
</tr>
<tr>
<td class="l noticeinfo"><i class="mustmark" style="margin-left:-7px">*</i>显示状态:</td>
<td class="r table_radio">

@ -35,6 +35,54 @@
<input type="text" class="txt " name="company_name" value="{$data.company_name}" placeholder="请输入推广公司名称">
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>联系结算人:</td>
<td class="r" >
<input type="text" class="txt " name="settlement_contact" value="{$data.settlement_contact}" placeholder="请输入结算联系人">
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>联系电话:</td>
<td class="r" >
<input type="text" class="txt " name="contact_phone" value="{$data.contact_phone}" placeholder="请输入联系电话">
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>所在地址:</td>
<td class="r" >
<input type="text" class="txt " name="address" value="{$data.address}" placeholder="请输入所在地址">
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>银行卡号:</td>
<td class="r" >
<input type="text" class="txt " name="bank_card" value="{$data.bank_card}" placeholder="请输入银行卡号">
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>银行卡名:</td>
<td class="r" >
<input type="text" class="txt " name="bank_cardname" value="{$data.bank_cardname}" placeholder="请输入银行卡名">
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>收款银行:</td>
<td class="r" >
<input type="text" class="txt " name="bank_name" value="{$data.bank_name}" placeholder="请输入收款银行">
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>开户网点:</td>
<td class="r" >
<input type="text" class="txt " name="bank_address" value="{$data.bank_address}" placeholder="请输入开户网点">
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px"></i>备注:</td>
<td class="r" >
<input type="text" class="txt " name="content" value="{$data.content}" placeholder="">
</td>
</tr>
<tr>
<td class="l noticeinfo"><i class="mustmark" style="margin-left:-7px">*</i>显示状态:</td>
<td class="r table_radio">

Loading…
Cancel
Save