| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- 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
- {
- use AsyncResponse, ErrorPush, Database;
- const ASNREFERENCE_2 = 'ASNREFERENCE2';
- public function __construct()
- {
- $this->data["active_test"] = "active";
- }
- public function method(Request $request, $method)
- {
- try {
- return call_user_func([$this, $method], $request);
- }catch (\BadMethodCallException $e){
- dd("方法不存在");
- }
- }
- public function test(){
- $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);
- }
- }
- }
- }
|