TestController.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Authority;
  4. use App\Commodity;
  5. use App\CommodityMaterialBoxModel;
  6. use App\Components\AsyncResponse;
  7. use App\Components\ErrorPush;
  8. use App\ErrorTemp;
  9. use App\Feature;
  10. use App\Http\ApiControllers\LoginController;
  11. use App\Http\Requests\OrderDelivering;
  12. use App\Jobs\CacheShelfTaskJob;
  13. use App\Jobs\OrderCreateInstantBill;
  14. use App\Jobs\OrderCreateWaybill;
  15. use App\Jobs\SettlementBillReportTask;
  16. use App\Jobs\StoreCreateInstantBill;
  17. use App\Jobs\WeightUpdateInstantBill;
  18. use App\MaterialBox;
  19. use App\MaterialBoxModel;
  20. use App\Order;
  21. use App\OrderPackage;
  22. use App\Owner;
  23. use App\OwnerFeeDetail;
  24. use App\OwnerFeeDetailLogistic;
  25. use App\OwnerFeeExpress;
  26. use App\OwnerFeeLogistic;
  27. use App\OwnerFeeOperation;
  28. use App\OwnerFeeOperationDetail;
  29. use App\OwnerFeeStorage;
  30. use App\OwnerPriceOperation;
  31. use App\OrderPackageCountingRecord;
  32. use App\RejectedBill;
  33. use App\Services\CacheShelfService;
  34. use App\Services\ForeignHaiRoboticsService;
  35. use App\Services\OrderService;
  36. use App\Services\OwnerFeeTotalService;
  37. use App\Services\OwnerLogisticFeeReportService;
  38. use App\Services\OwnerPriceOperationService;
  39. use App\Services\OwnerStoreFeeReportService;
  40. use App\Services\OwnerStoreOutFeeReportService;
  41. use App\Services\StationService;
  42. use App\Services\StorageService;
  43. use App\Station;
  44. use App\StationTask;
  45. use App\StationTaskMaterialBox;
  46. use App\Store;
  47. use App\TaskTransaction;
  48. use App\Unit;
  49. use App\User;
  50. use App\UserDetail;
  51. use App\UserDutyCheck;
  52. use App\ValueStore;
  53. use App\Waybill;
  54. use Carbon\Carbon;
  55. use Carbon\CarbonPeriod;
  56. use Firebase\JWT\JWT;
  57. use Illuminate\Database\Eloquent\Collection;
  58. use Illuminate\Foundation\Http\FormRequest;
  59. use Illuminate\Http\Request;
  60. use Illuminate\Support\Facades\Cache;
  61. use Illuminate\Support\Facades\Auth;
  62. use Illuminate\Support\Facades\Cookie;
  63. use Illuminate\Support\Facades\DB;
  64. use Illuminate\Support\Facades\Http;
  65. use Illuminate\Support\Facades\URL;
  66. use PhpOffice\PhpSpreadsheet\Calculation\Web\Service;
  67. class TestController extends Controller
  68. {
  69. use AsyncResponse,ErrorPush;
  70. const ASNREFERENCE_2 = 'ASNREFERENCE2';
  71. public function __construct()
  72. {
  73. $this->data["active_test"] = "active";
  74. }
  75. public function method(Request $request, $method)
  76. {
  77. return call_user_func([$this, $method], $request);
  78. }
  79. public function test4()
  80. {
  81. $user = User::query()->first();
  82. $b = file_get_contents(base_path().'/public.pem');
  83. $decoded = JWT::decode("eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJkYXRhIjp7ImZpZWxkMSI6MSwiZmllbGQyIjoic3RyaW5nIGRhdGEifSwiaXNzIjoiaHR0cDpcL1wvZXhhbXBsZS5vcmciLCJhdWQiOiJodHRwOlwvXC9leGFtcGxlLmNvbSIsImlhdCI6MTYyOTc3NDUxMywiZWF0IjoxNjI5NzgxNzEzfQ.Twl3_KPMLP4Pi4zaGZig8SKhE9M6nZlCI8bVifWjuYIWuqZtlujp35Zvv1oY0GnPIkUmq-PGJZLU96mmT-RTRDL-83sPF2l7PPTeriYMoiKP1r2rsI421BtrgLs0qP7QCPxH5BmHWXAVbwTtnwv8JagKzcZxkZJRH3Lj8blRapumnCk-tMfHz4xiXHIATfMS1I23vhJJLomC-KW4Ou3pjTu6X3HiiUGe9ZBGTu5mHfiKm25dxXO5Fm3JMg2-anLf_Gy6D6D7IQJ5pM5HFEN-HdD7FibeEMraMxbk5B_82L15OjhaoCV7b7ioXNSs2QAdlRfuRgx0XIE_toFwb_152a", $b, ['RS256']);
  84. $payload = [
  85. 'data' => ['field1' => 1, 'field2' => 'string data'],
  86. "iss" => "http://example.org",
  87. "aud" => "http://example.com",
  88. "iat" => time(),
  89. "eat" => time()+7200,
  90. ];
  91. try {
  92. $token = JWT::encode($payload, $a, 'RS256');
  93. }catch (\Exception $e){
  94. $this->error("HTTP:409,资源异常,无法反馈");
  95. }
  96. try {
  97. $a = file_get_contents("test");
  98. }catch (\Exception $e){
  99. if (strpos($e->getMessage(),"No such file or directory")!==false)$this->error("HTTP:410,服务器异常,资源丢失");
  100. else $this->error("HTTP:403,访问某些资源失败");
  101. }
  102. $payload = [
  103. 'data' => ['field1' => 1, 'field2' => 'string data'],
  104. "iss" => "http://example.org",
  105. "aud" => "http://example.com",
  106. "iat" => time(),
  107. "eat" => time()+7200,
  108. ];
  109. $token = JWT::encode($payload, $a, 'RS256');
  110. echo "Token:\n" . print_r($token, true) . "\n";
  111. $decoded = JWT::decode($token, $b, ['RS256']);
  112. $decoded_array = (array) $decoded;
  113. echo "Decoded:\n" . print_r($decoded_array, true) . "\n";
  114. }
  115. public function OwnerStoreFeeReportService_recordReport()
  116. {
  117. /** @var OwnerStoreFeeReportService $service */
  118. $service = app('OwnerStoreFeeReportService');
  119. $service->recordReport('2021-08-01');
  120. }
  121. public function OwnerStoreOutFeeReportService_recordReport()
  122. {
  123. /** @var OwnerStoreOutFeeReportService $service */
  124. $service = app('OwnerStoreOutFeeReportService');
  125. $service->recordReport('2021-08-01');
  126. }
  127. public function OwnerFeeTotalService_record()
  128. {
  129. /** @var OwnerFeeTotalService $service */
  130. $service = app('OwnerFeeTotalService');
  131. $service->record('2021-08-01');
  132. }
  133. //快递
  134. public function OwnerLogisticFeeReportService_record()
  135. {
  136. ini_set('max_execution_time',-1);
  137. /** @var OwnerLogisticFeeReportService $service */
  138. $service = app('OwnerLogisticFeeReportService');
  139. $service->recordReport('2021-08-01');
  140. }
  141. public function order_packages_sync_routes_flag_init()
  142. {
  143. OrderPackage::query()->whereNotNull('transfer_status')->update(['sync_routes_flag'=>true]);
  144. }
  145. public function SettlementBillReportTask()
  146. {
  147. SettlementBillReportTask::dispatchNow('2021-08-01');
  148. }
  149. }