Commit 5e1a926c authored by sugar's avatar sugar

Merge branch 'dev' of http://rungit.jxdsy.cn:10000/sugar/zhupu into dev

parents 18b3c334 5e5b77c6
......@@ -670,4 +670,32 @@ if (!function_exists('getRecursion')) {
return $file;
}
}
if (!function_exists('create_randomstr')) {
/**
* 生成随机字符串(数字字母小写)
* @param string $lenth 长度
* @return string 字符串
*/
function create_randomstr($lenth = 8)
{
$code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$rand = $code[rand(0,25)]
.strtoupper(dechex(date('m')))
.date('d').substr(time(),-5)
.substr(microtime(),2,5)
.sprintf('%02d',rand(0,99));
for(
$a = md5( $rand, true ),
$s = '0123456789ABCDEFGHIJKLMNOPQRSTUV',
$d = '',
$f = 0;
$f < $lenth;
$g = ord( $a[ $f ] ),
$d .= $s[ ( $g ^ ord( $a[ $f + $lenth ] ) ) - $g & 0x1F ],
$f++
);
return $d;
}
}
}
\ No newline at end of file
......@@ -56,6 +56,7 @@ class FamilyTreeService
}else{
$family_id = isset($param['family_id'])?$param['family_id']:$family_id;
if(!empty($family_id)) FamilyModel::where(['id'=>$family_id])->setInc('join_number');
$people["activation_code"]=create_randomstr();
return FamilyPeopleModel::dataAdd($people);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment