fastadmin字段唯一性验证-靳宇灵

舟海君

关注

阅读 31

2022-12-19

<input id="c-materialcode" class="form-control" name="row[materialcode]" type="text" data-rule="required;remote(product/tuzhi/check)">

  • 字段唯一性验证

public function check()

   {

       $params = $this->request->post('row/a');

       $materialcode = $params['materialcode'];

       $materialcode = Db::table('tt_product_machine')->where('materialcode',$materialcode)->find();

       if($materialcode!=NULL){

           return $this->error('编码已存在,重新输入!');

       }else{

           return $this->success('编码可用!');

       }

       

   }

精彩评论(0)

0 0 举报