<?php


namespace app\shared\model;

use think\Model as ThinkModel;
//兑换码
class Conversion extends ThinkModel
{
    // 设置当前模型对应的完整数据表名称
    protected $name = 'shared_conversion';
    const TABLE_NAME="shared_conversion";
    // 自动写入时间戳
    protected $autoWriteTimestamp = true;

    static public function createCode($len=8){
    	$code=create_code($len);
    	while (self::where('code',$code)->count()) {
    		self::createCode($len);
    	}
    	return $code;
    }
}