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