123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- use Illuminate\Support\Str;
- function judge_level($level){
- switch ($level){
- case 1:
- $level='销售主管';
- break;
- case 2:
- $level='销售经理';
- break;
- case 3:
- $level='代理公司';
- break;
- }
- return $level;
- }
- function judge_level_name($level){
- switch ($level){
- case '销售主管':
- $level=1;
- break;
- case '销售经理':
- $level=2;
- break;
- case '代理公司':
- $level=3;
- break;
- }
- return $level;
- }
- function make_excerpt($value, $length = 200)
- {
- $excerpt = trim(preg_replace('/\r\n|\r|\n+/', ' ', strip_tags($value)));
- return str_limit($excerpt, $length);
- }
- function str_limit($value, $limit = 100, $end = '...')
- {
- return Str::limit($value, $limit, $end);
- }
- function code($phone){
- $data=md5(uniqid($phone));
- // return $data;
- $data=substr($data,1,6);
- return $data;
- }
- function str_random($length = 16)
- {
- return Str::random($length);
- }
- function auth_code($id){
- $code_3=str_pad($id, 6, 0, STR_PAD_LEFT);
- $code='TNSJ'.mb_substr($code_3,0,3).date('ymd',time()).mb_substr($code_3,3,3);
- return $code;
- }
- //function public_path($path = '')
- //{
- // return app()->make('path.public').($path ? DIRECTORY_SEPARATOR.ltrim($path, DIRECTORY_SEPARATOR) : $path);
- //}
|