Test.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. namespace app\admin\command;
  3. use think\console\Command;
  4. use think\console\Input;
  5. use think\console\Output;
  6. use think\Db;
  7. class Test extends Command
  8. {
  9. protected function configure()
  10. {
  11. $this->setName('test')->setDescription('Here is the remark ');
  12. }
  13. protected function execute(Input $input, Output $output)
  14. {
  15. // $list =["CJ1745TKS","CJ1745TKR"];
  16. // foreach ($list as $key=>$value){
  17. $starttime = "2022-2-1 00:00:00";
  18. $expiretime = "2023-4-30 23:59:59";
  19. $username=229867;
  20. while ($username<=229999){
  21. $pasword = randomkeys(2).rand(1000,9999);
  22. $salt = makeSalt();
  23. $pas = sha1($pasword.$salt);
  24. $data=[
  25. "username"=>"CJ1745TKR".$username,
  26. "password"=>$pas,
  27. "account_type"=>2,
  28. "pwd"=>$pasword,
  29. "salt"=>$salt,
  30. "status"=>0,
  31. "is_del"=>0,
  32. "starttime"=>$starttime,
  33. "expiretime"=>$expiretime,
  34. "addtime"=>date("Y-m-d H:i:s"),
  35. "updatetime"=>date("Y-m-d H:i:s")
  36. ];
  37. $acccount = Db::name("account")->insert($data,false,true);
  38. if($acccount>0){
  39. $user=[
  40. "nickname"=>$username,
  41. "mobile"=>"",
  42. "avatar"=>"",
  43. "remark"=>"",
  44. "sex"=>"",
  45. "addtime"=>date("Y-m-d H:i:s"),
  46. "updatetime"=>date("Y-m-d H:i:s")
  47. ];
  48. $info = Db::name("account_info")->insert($user,false,true);
  49. if($info>0){
  50. $rela=["accountid"=>$acccount,"account_info"=>$info];
  51. $rela_acc=Db::name("rela_account")->insert($rela);
  52. if($rela_acc){
  53. $datas=[
  54. "accountid"=>$acccount,
  55. "stock_total"=>12,
  56. "stock_used"=>0,
  57. "stock_balance"=>12,
  58. "stock_delivery"=>0,
  59. "status"=>0,
  60. "is_del"=>0,
  61. "addtime"=>date("Y-m-d H:i:s"),
  62. "updatetime"=>date("Y-m-d H:i:s")
  63. ];
  64. $query =Db::name("account_stock")->insert($datas);
  65. $username++;
  66. continue;
  67. }
  68. }
  69. }
  70. break;
  71. // }
  72. }
  73. }
  74. }