TestController.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Components\AsyncResponse;
  4. use App\Components\Database;
  5. use App\Components\ErrorPush;
  6. use App\MaterialBox;
  7. use App\MaterialBoxModel;
  8. use App\Services\AuthorityService;
  9. use App\Services\RejectedService;
  10. use App\User;
  11. use App\Waybill;
  12. use Illuminate\Http\Request;
  13. use Illuminate\Support\Facades\DB;
  14. use Illuminate\Support\Facades\Log;
  15. class TestController extends Controller
  16. {
  17. use AsyncResponse, ErrorPush, Database;
  18. const ASNREFERENCE_2 = 'ASNREFERENCE2';
  19. public function __construct()
  20. {
  21. $this->data["active_test"] = "active";
  22. }
  23. public function method(Request $request, $method)
  24. {
  25. try {
  26. return call_user_func([$this, $method], $request);
  27. }catch (\BadMethodCallException $e){
  28. dd("方法不存在");
  29. }
  30. }
  31. public function test(Request $request)
  32. {
  33. $s = new AuthorityService();
  34. $s->removeAdminAuth();
  35. dd(1);
  36. Log::error(json_encode($request->header(),JSON_UNESCAPED_UNICODE));
  37. return json_encode($request->header(),JSON_UNESCAPED_UNICODE);
  38. }
  39. private function paramDefault($waybill):array
  40. {
  41. $update = [];
  42. if (!$waybill->order_type){
  43. $update["order_type"] = $waybill->order_type = Waybill::ORDER_TYPE_DEFAULT;
  44. }
  45. if (!$waybill->transport_type){
  46. $update["transport_type"] = $waybill->transport_type = "JZKH";
  47. }
  48. if (!$waybill->cargo_name){
  49. $update["cargo_name"] = $waybill->cargo_name = "补货";
  50. }
  51. if (!$waybill->total_number){
  52. $update["total_number"] = $waybill->total_number = 1;
  53. }
  54. if (!$waybill->total_weight){
  55. $update["total_weight"] = $waybill->total_weight = 1;
  56. }
  57. if (!$waybill->package_service){
  58. $update["package_service"] = $waybill->package_service = '托膜';
  59. }
  60. if (!$waybill->deliveryType_id){
  61. $update["deliveryType_id"] = $waybill->deliveryType_id = 3;
  62. }
  63. if (!$waybill->pay_type){
  64. $update["pay_type"] = $waybill->pay_type = Waybill::PAY_TYPE_DEFAULT;
  65. }
  66. if (!$waybill->back_sign_bill){
  67. $update["back_sign_bill"] = $waybill->back_sign_bill = Waybill::BACK_SIGN_BILL_DEFAULT;
  68. }
  69. return array($update,$waybill);
  70. }
  71. }