TestController.php 2.2 KB

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