You've already forked qlg.tsgz.moe
							
							
		
			
				
	
	
		
			60 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			60 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
| <?php 
 | |
| namespace wstmart\admin\validate;
 | |
| use think\Validate;
 | |
| /**
 | |
|  * ============================================================================
 | |
|  * 店铺验证器
 | |
|  */
 | |
| class Shops extends Validate{
 | |
| 	protected $rule = [
 | |
| 	    ['shopSn','checkShopSn:1','请输入店铺编号|店铺编号不能超过20个字符'],
 | |
| 	    ['shopName'  ,'require|max:40','请输入店铺名称|店铺名称不能超过20个字符'],
 | |
|         ['shopCompany'  ,'require|max:300','请输入公司名称|公司名称不能超过100个字符'],
 | |
|         ['shopTel'  ,'require|max:40','请输入公司联系电话|公司联系电话不能超过20个字符'],
 | |
|         ['shopkeeper'  ,'require|max:100','请输入公司紧急联系人|公司紧急联系人不能超过50个字符'],
 | |
|         ['telephone'  ,'require|max:40','请输入公司紧急联系人手机|公司紧急联系人手机不能超过20个字符'],
 | |
|         ['isSelf'  ,'in:0,1','无效的自营店类型'],
 | |
|         ['shopImg'  ,'require','请上传店铺图标'],
 | |
|         ['areaId'  ,'require','请选择公司所在区域'],
 | |
|         ['shopAddress'  ,'require','请输入公司详细地址'],
 | |
|         ['isInvoice'  ,'in:0,1','无效的发票类型'],
 | |
|         ['invoiceRemarks','checkInvoiceRemark:1','请输入发票说明'],
 | |
|         ['shopAtive'  ,'in:0,1','无效的营业状态'],
 | |
|         ['bankUserName'  ,'require|max:100','请输入银行开户名|银行开户名称长度不能能超过50个字符'],
 | |
|         ['bankNo'  ,'require','请输入对公结算银行账号'],
 | |
|         ['bankId'  ,'require','请选择结算银行'],
 | |
|        // ['bankAreaId'  ,'require','请选择开户所地区'],
 | |
|         ['shopStatus'  ,'in:-1,1','无效的店铺状态'],
 | |
|         ['statusDesc'  ,'checkStatusDesc:1','请输入店铺停止原因']
 | |
|     ];
 | |
| 
 | |
|     protected $scene = [
 | |
|         'add'   =>  ['shopSn','shopName','shopCompany','shopkeeper','telephone','shopCompany','shopTel','isSelf','shopImg',
 | |
|                      'areaId','shopAddress','isInvoice','shopAtive','bankId','bankAreaId','bankNo','bankUserName','shopAtive'],
 | |
|         'edit'  =>  ['shopSn','shopName','shopCompany','shopkeeper','telephone','shopCompany','shopTel','isSelf','shopImg',
 | |
|                      'areaId','shopAddress','isInvoice','shopAtive','bankId','bankAreaId','bankNo','bankUserName','shopAtive']
 | |
|     ]; 
 | |
|     
 | |
|     protected function checkShopSn($value){
 | |
|     	$shopId = Input('post.shopId/d',0);
 | |
|     	$key = Input('post.shopSn');
 | |
|     	if($shopId>0){
 | |
|     		if($key=='')return '请输入店铺编号';
 | |
|     		$isChk = model('Shops')->checkShopSn($key,$shopId);
 | |
|     		if($isChk)return '对不起,该店铺编号已存在';
 | |
|     	}
 | |
|     	return true;
 | |
|     }
 | |
|     
 | |
|     protected function checkInvoiceRemark($value){
 | |
|     	$isInvoice = Input('post.isInvoice/d',0);
 | |
|     	$key = Input('post.invoiceRemarks');
 | |
|     	return ($isInvoice==1 && $key=='')?'请输入发票说明':true;
 | |
|     }
 | |
|     
 | |
|     protected function checkStatusDesc($value){
 | |
|     	$shopStatus = Input('post.shopStatus/d',0);
 | |
|     	$key = Input('post.statusDesc');
 | |
|     	return ($shopStatus==-1 && $key=='')?'请输入店铺停止原因':true;
 | |
|     }
 | |
| } |