|
|
@@ -5,10 +5,13 @@ namespace App\Http\Controllers;
|
|
|
use App\Components\AsyncResponse;
|
|
|
use App\Components\Database;
|
|
|
use App\Components\ErrorPush;
|
|
|
+use App\Exceptions\Exception;
|
|
|
use App\Services\WaybillService;
|
|
|
+use App\User;
|
|
|
use App\Waybill;
|
|
|
use Illuminate\Http\Request;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
+use Illuminate\Support\Facades\Hash;
|
|
|
|
|
|
class TestController extends Controller
|
|
|
{
|
|
|
@@ -30,21 +33,23 @@ class TestController extends Controller
|
|
|
}
|
|
|
}
|
|
|
public function test(){
|
|
|
- $sql = <<<SQL
|
|
|
-select * from equipment where id in (
|
|
|
- select parent_id from equipment where parent_id in (select id from equipment where info like '%"id":2%' and code like 'H%')
|
|
|
- group by parent_id having (count(*)<5)
|
|
|
-);
|
|
|
-SQL;
|
|
|
-
|
|
|
- $arr = DB::connection("aliyunMysql")->select(DB::raw($sql));
|
|
|
- $insert = <<<SQL
|
|
|
-insert into equipment(repository_id, code, parent_id, info, depth, width, height, containers, location_tab, created_at, updated_at, tandem)
|
|
|
-values (?,?,?,null,?,?,1.8,null,'0-0','2022-01-13 16:08:00','2022-01-13 16:08:00',null)
|
|
|
-SQL;
|
|
|
-
|
|
|
- foreach ($arr as $item){
|
|
|
- DB::connection("aliyunMysql")->insert($insert, [$item->repository_id,$item->code."-1",$item->id,$item->depth,$item->width]);
|
|
|
+ $a = "12345678";
|
|
|
+ Hash::check($a,$hash);
|
|
|
+ $hash = password_hash($a, PASSWORD_BCRYPT, ['cost' => 10]);
|
|
|
+ $prefix = substr($hash, 0 ,29);
|
|
|
+ //dd(crypt($a, $prefix),$a,$prefix);
|
|
|
+ dd($hash === crypt($a, $prefix));
|
|
|
+ $strs="QWERTYUIOPASDFGHJKLZXCVBNM1234567890qwertyuiopasdfghjklzxcvbnm";
|
|
|
+ $users = User::query()->get();
|
|
|
+ foreach ($users as $user){
|
|
|
+ $name=substr(str_shuffle($strs),mt_rand(0,strlen($strs)-11),6);
|
|
|
+ try {
|
|
|
+ DB::connection("system")->insert("insert into sys_user(id,username,password,email,salt,service,create_time) VALUES(?,?,?,?,?,?,?)",[
|
|
|
+ $user->id,$user->name,$user->password,$user->email,$name, "SWMS", date('Y-m-d H:i:s')
|
|
|
+ ]);
|
|
|
+ }catch (\Exception $e){
|
|
|
+ dump($user);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|