| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 | 
							- <?php
 
- namespace app\model;
 
- use support\Model;
 
- class MedicalSalesman extends Model
 
- {
 
-     protected $table = 'medical_salesman';
 
-     protected $primaryKey = 'salesman_id';
 
-     protected $dateFormat = 'U';
 
-     public const CREATED_AT = 'salesman_addTime';
 
-     public const UPDATED_AT = 'salesman_updateTime';
 
-     public function serializeDate(\DateTimeInterface $date)
 
-     {
 
-         return $date->format('Y-m-d H:i:s');
 
-     }
 
-     public function shop()
 
-     {
 
-         return $this->hasOne(MedicalShop::class,'shop_id','salesman_shop_id');
 
-     }
 
-     /**
 
-      * @Desc 手机号是否已存在
 
-      * @Author Gorden
 
-      * @Date 2024/3/4 9:46
 
-      *
 
-      * @param $phone
 
-      * @return bool
 
-      */
 
-     public function phoneExist($phone)
 
-     {
 
-         return self::where('salesman_phone', $phone)->exists();
 
-     }
 
-     /**
 
-      * @Desc 用户名是否存在
 
-      * @Author Gorden
 
-      * @Date 2024/3/4 10:08
 
-      *
 
-      * @param $username
 
-      * @return bool
 
-      */
 
-     public function usernameExist($username)
 
-     {
 
-         return self::where('salesman_username', $username)->exists();
 
-     }
 
-     /**
 
-      * @Desc 更新时,验证手机号是否在其他账号下出现
 
-      * @Author Gorden
 
-      * @Date 2024/3/4 10:14
 
-      *
 
-      * @param $phone
 
-      * @param $id
 
-      * @return bool
 
-      */
 
-     public function phoneIsInOtherAccountExist($phone, $id)
 
-     {
 
-         return self::where('salesman_phone', $phone)
 
-             ->where('salesman_id', '<>', $id)
 
-             ->exists();
 
-     }
 
-     /**
 
-      * @Desc 更新时,验证用户名是否在其他账号下出现
 
-      * @Author Gorden
 
-      * @Date 2024/3/4 10:16
 
-      *
 
-      * @param $username
 
-      * @param $id
 
-      * @return bool
 
-      */
 
-     public function usernameIsInOtherAccountExist($username, $id)
 
-     {
 
-         return self::where('salesman_username', $username)
 
-             ->where('salesman_id', '<>', $id)
 
-             ->exists();
 
-     }
 
- }
 
 
  |