1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- namespace app\common\validate;
- use think\Db;
- use think\Validate;
- class PayWages extends Validate{
- protected $rule = [
- 'id' => 'require|gt:0',
- 'content' => 'require|checkContent',
- ];
- protected $message = [
- 'id.require' => '参数错误',
- 'id.gt' => '参数错误',
- 'content.require' => '参数错误',
- ];
- protected $scene = [
- ];
- protected function checkContent($value,$rule,$data=[])
- {
- $content = json_decode($data['content'],true);
- if(!$content){
- return '参数错误';
- }
- $info = Db::name('pay_wages')->where('id',$data['id'])->find();
- if(!$info){
- return '参数错误';
- }
- // if($info['company_id'] == 2 && $info['type'] == 3 && count($content) != 50){
- // return '参数错误';
- // }
- // if(($info['company_id'] == 1 || ($info['company_id'] == 2 && $info['type'] != 3)) && count($content) != 65){
- // return '参数错误';
- // }
- return true;
- }
- }
|