12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace app\common\model;
- use think\Model;
- use think\Db;
- use fast\Random;
- /**
- * 模型
- */
- class Family extends Model
- {
- // 开启自动写入时间戳字段
- protected $autoWriteTimestamp = 'int';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- /**
- * 生成不重复的随机数字
- */
- public static function getUinqueId($length = 4,$ids = []) {
- $newid = Random::build("nozero",$length);
- if(in_array($newid,$ids)) {
- self::getUinqueId(4,$ids);
- }
- return $newid;
- }
- public function familymember()
- {
- return $this->hasMany('FamilyMember', 'guild_id', 'id',[],'LEFT');
- }
- }
|