Test.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. $starttime = "2021-10-1 00:00:00";
  16. $expiretime = "2022-9-30 23:59:59";
  17. $username=1745210000;
  18. // $uid = 1;
  19. // while ($uid<=10000){
  20. // $data=[
  21. // "accountid"=>$uid,
  22. // "stock_total"=>300,
  23. // "stock_used"=>0,
  24. // "stock_balance"=>300,
  25. // "stock_delivery"=>0,
  26. // "status"=>1,
  27. // "is_del"=>0,
  28. // "addtime"=>date("Y-m-d H:i:s"),
  29. // "updatetime"=>date("Y-m-d H:i:s")
  30. // ];
  31. // Db::name("account_stock")->insert($data);
  32. // $uid++;
  33. // }
  34. while ($username<=1745219999){
  35. // Db::startTrans();
  36. $pasword = randomkeys(2).rand(1000,9999);
  37. $salt = makeSalt();
  38. $pas = sha1($pasword.$salt);
  39. $data=[
  40. "username"=>"CJ".$username,
  41. "password"=>$pas,
  42. "pwd"=>$pasword,
  43. "salt"=>$salt,
  44. "status"=>0,
  45. "is_del"=>0,
  46. "starttime"=>$starttime,
  47. "expiretime"=>$expiretime,
  48. "addtime"=>date("Y-m-d H:i:s"),
  49. "updatetime"=>date("Y-m-d H:i:s")
  50. ];
  51. $acccount = Db::name("account")->insert($data,false,true);
  52. $username++;
  53. // if($acccount>0){
  54. // $user=[
  55. // "nickname"=>$username,
  56. // "mobile"=>"",
  57. // "avatar"=>"",
  58. // "remark"=>"",
  59. // "sex"=>"",
  60. // "addtime"=>date("Y-m-d H:i:s"),
  61. // "updatetime"=>date("Y-m-d H:i:s")
  62. // ];
  63. // $info = Db::name("account_info")->insert($user,false,true);
  64. // if($info>0){
  65. // $rela=["accountid"=>$acccount,"account_info"=>$info];
  66. // $rela_acc=Db::name("rela_account")->insert($rela);
  67. // if($rela_acc){
  68. // write_log("账户{$username}新建成功","","account","add");
  69. // Db::commit();
  70. // $username++;
  71. // continue;
  72. // }
  73. //
  74. // }
  75. // }
  76. // Db::rollback();
  77. // break;
  78. }
  79. }
  80. }