wesmiler 6 年之前
父節點
當前提交
f630905ac6

+ 0 - 120
public/color.log

@@ -1,120 +0,0 @@
-array (
-  'id' => 263,
-  'order_sn' => 'PR2002131400006482665',
-  'user_id' => 65,
-  'shop_uid' => 3,
-  'device_id' => 21,
-  'api_key' => '4564565464',
-  'pid' => 398,
-  'name' => 'u=136104178,4278330209&fm=26&gp=0.jpg',
-  'url' => 'print/20200213/a0f2e2da217329e5c03f17e0273c734c.jpg',
-  'nums' => 1,
-  'type' => 1,
-  'file_type' => 'jpg',
-  'page_start' => 1,
-  'page_end' => 1,
-  'print_type' => 1,
-  'page_type' => 2,
-)array (
-  'id' => 263,
-  'order_sn' => 'PR2002131400006482665',
-  'user_id' => 65,
-  'shop_uid' => 3,
-  'device_id' => 21,
-  'api_key' => '4564565464',
-  'pid' => 398,
-  'name' => 'u=136104178,4278330209&fm=26&gp=0.jpg',
-  'url' => 'print/20200213/a0f2e2da217329e5c03f17e0273c734c.jpg',
-  'nums' => 1,
-  'type' => 1,
-  'file_type' => 'jpg',
-  'page_start' => 1,
-  'page_end' => 1,
-  'print_type' => 1,
-  'page_type' => 2,
-)array (
-  'id' => 263,
-  'order_sn' => 'PR2002131400006482665',
-  'user_id' => 65,
-  'shop_uid' => 3,
-  'device_id' => 21,
-  'api_key' => '4564565464',
-  'pid' => 398,
-  'name' => 'u=136104178,4278330209&fm=26&gp=0.jpg',
-  'url' => 'print/20200213/3511ddffdfdec9ae3838da53c5e0045f.jpg',
-  'nums' => 1,
-  'type' => 1,
-  'file_type' => 'jpg',
-  'page_start' => 1,
-  'page_end' => 1,
-  'print_type' => 1,
-  'page_type' => 2,
-)falsearray (
-  'id' => 263,
-  'order_sn' => 'PR2002131400006482665',
-  'user_id' => 65,
-  'shop_uid' => 3,
-  'device_id' => 21,
-  'api_key' => '4564565464',
-  'pid' => 398,
-  'name' => 'u=136104178,4278330209&fm=26&gp=0.jpg',
-  'url' => 'print/20200213/3511ddffdfdec9ae3838da53c5e0045f.jpg',
-  'nums' => 1,
-  'type' => 1,
-  'file_type' => 'jpg',
-  'page_start' => 1,
-  'page_end' => 1,
-  'print_type' => 1,
-  'page_type' => 2,
-)falsearray (
-  'id' => 263,
-  'order_sn' => 'PR2002131400006482665',
-  'user_id' => 65,
-  'shop_uid' => 3,
-  'device_id' => 21,
-  'api_key' => '4564565464',
-  'pid' => 398,
-  'name' => 'u=136104178,4278330209&fm=26&gp=0.jpg',
-  'url' => 'print/20200213/3511ddffdfdec9ae3838da53c5e0045f.jpg',
-  'nums' => 1,
-  'type' => 1,
-  'file_type' => 'jpg',
-  'page_start' => 1,
-  'page_end' => 1,
-  'print_type' => 1,
-  'page_type' => 2,
-)falsearray (
-  'id' => 263,
-  'order_sn' => 'PR2002131400006482665',
-  'user_id' => 65,
-  'shop_uid' => 3,
-  'device_id' => 21,
-  'api_key' => '4564565464',
-  'pid' => 398,
-  'name' => 'u=136104178,4278330209&fm=26&gp=0.jpg',
-  'url' => 'print/20200213/3511ddffdfdec9ae3838da53c5e0045f.jpg',
-  'nums' => 1,
-  'type' => 1,
-  'file_type' => 'jpg',
-  'page_start' => 1,
-  'page_end' => 1,
-  'print_type' => 1,
-  'page_type' => 2,
-)falsearray (
-  'id' => 263,
-  'order_sn' => 'PR2002131400006482665',
-  'user_id' => 65,
-  'shop_uid' => 3,
-  'device_id' => 21,
-  'api_key' => '4564565464',
-  'pid' => 398,
-  'name' => 'u=136104178,4278330209&fm=26&gp=0.jpg',
-  'url' => 'print/20200213/3511ddffdfdec9ae3838da53c5e0045f.jpg',
-  'nums' => 1,
-  'type' => 1,
-  'file_type' => 'jpg',
-  'page_start' => 1,
-  'page_end' => 1,
-  'print_type' => 1,
-  'page_type' => 2,
-)

+ 0 - 1
public/test.log

@@ -1 +0,0 @@
-'./logs/'

+ 0 - 203
public/test_print.log

@@ -1,203 +0,0 @@
-array (
-  'key' => '06b969c37f8a15931e772daf9017e3da',
-  'sourceFile' => 'http://print.dongerkj.com/upload/print/20200105/099c0063ff30e555e006d640f01a72c4.jpg',
-  'Type' => 'img',
-  'filename' => '下载 (1).jpg',
-  'trueColor' => 'False',
-  'Copies' => 1,
-  'Landscape' => 'False',
-  'Scaling' => 'True',
-  'tasktype' => 'now',
-  'printtime' => 1578205803,
-  'callBackUrl' => 'http://print.dongerkj.com/weixin/notify/prints',
-  'topMargin' => 10,
-  'leftMargin' => 10,
-  'Width' => 180,
-  'Height' => 297,
-)array (
-  'key' => '06b593e9052d9d2fa7c7f7c89b4b018a',
-  'sourceFile' => 'http://print.dongerkj.com/upload/print/20200105/099c0063ff30e555e006d640f01a72c4.jpg',
-  'Type' => 'img',
-  'filename' => '下载 (1).jpg',
-  'trueColor' => 'False',
-  'Copies' => 1,
-  'Landscape' => 'False',
-  'Scaling' => 'True',
-  'tasktype' => 'now',
-  'printtime' => 1578205847,
-  'callBackUrl' => 'http://print.dongerkj.com/weixin/notify/prints',
-  'topMargin' => 10,
-  'leftMargin' => 10,
-  'Width' => 180,
-  'Height' => 297,
-)array (
-  'key' => '06b593e9052d9d2fa7c7f7c89b4b018a',
-  'sourceFile' => 'http://print.dongerkj.com/upload/print/20200105/bca49ad95e6c89bd5c76bcd5f86c55a1.jpg',
-  'Type' => 'img',
-  'filename' => '下载.jpg',
-  'trueColor' => 'False',
-  'Copies' => 1,
-  'Landscape' => 'False',
-  'Scaling' => 'True',
-  'tasktype' => 'now',
-  'printtime' => 1578205918,
-  'callBackUrl' => 'http://print.dongerkj.com/weixin/notify/prints',
-  'topMargin' => 10,
-  'leftMargin' => 10,
-  'Width' => 180,
-  'Height' => 297,
-)array (
-  'key' => '06b593e9052d9d2fa7c7f7c89b4b018a',
-  'sourceFile' => 'http://print.dongerkj.com/upload/print/20200105/bca49ad95e6c89bd5c76bcd5f86c55a1.jpg',
-  'Type' => 'img',
-  'filename' => '下载.jpg',
-  'trueColor' => 'False',
-  'Copies' => 1,
-  'Landscape' => 'False',
-  'Scaling' => 'True',
-  'tasktype' => 'now',
-  'printtime' => 1578206117,
-  'callBackUrl' => 'http://print.dongerkj.com/weixin/notify/prints',
-  'topMargin' => 10,
-  'leftMargin' => 10,
-  'Width' => 180,
-  'Height' => 297,
-)array (
-  'key' => '06b593e9052d9d2fa7c7f7c89b4b018a',
-  'sourceFile' => 'http://print.dongerkj.com/upload/print/20200105/bca49ad95e6c89bd5c76bcd5f86c55a1.jpg',
-  'Type' => 'img',
-  'filename' => '下载.jpg',
-  'trueColor' => 'False',
-  'Copies' => 1,
-  'Landscape' => 'False',
-  'Scaling' => 'True',
-  'tasktype' => 'now',
-  'printtime' => 1578206288,
-  'callBackUrl' => 'http://print.dongerkj.com/weixin/notify/prints',
-  'topMargin' => 10,
-  'leftMargin' => 10,
-  'Width' => 180,
-  'Height' => 297,
-)array (
-  'key' => '06b593e9052d9d2fa7c7f7c89b4b018a',
-  'sourceFile' => 'http://print.dongerkj.com/upload/print/20200105/bca49ad95e6c89bd5c76bcd5f86c55a1.jpg',
-  'Type' => 'img',
-  'filename' => '下载.jpg',
-  'trueColor' => 'False',
-  'Copies' => 1,
-  'Landscape' => 'False',
-  'Scaling' => 'True',
-  'tasktype' => 'now',
-  'printtime' => 1578206377,
-  'callBackUrl' => 'http://print.dongerkj.com/weixin/notify/prints',
-  'topMargin' => 10,
-  'leftMargin' => 10,
-  'Width' => 180,
-  'Height' => 297,
-)array (
-  'key' => '06b593e9052d9d2fa7c7f7c89b4b018a',
-  'sourceFile' => 'http://print.dongerkj.com/upload/print/20200105/bca49ad95e6c89bd5c76bcd5f86c55a1.jpg',
-  'Type' => 'img',
-  'filename' => '下载.jpg',
-  'trueColor' => 'False',
-  'Copies' => 1,
-  'Landscape' => 'False',
-  'Scaling' => 'True',
-  'tasktype' => 'now',
-  'printtime' => 1578206547,
-  'callBackUrl' => 'http://print.dongerkj.com/weixin/notify/prints',
-  'topMargin' => 5,
-  'leftMargin' => 10,
-  'Width' => 180,
-  'Height' => 297,
-)array (
-  'key' => '06b593e9052d9d2fa7c7f7c89b4b018a',
-  'sourceFile' => 'http://print.dongerkj.com/upload/print/20200105/bca49ad95e6c89bd5c76bcd5f86c55a1.jpg',
-  'Type' => 'img',
-  'filename' => '下载.jpg',
-  'trueColor' => 'False',
-  'Copies' => 1,
-  'Landscape' => 'False',
-  'Scaling' => 'True',
-  'tasktype' => 'now',
-  'printtime' => 1578206853,
-  'callBackUrl' => 'http://print.dongerkj.com/weixin/notify/prints',
-  'leftMargin' => 10,
-  'Width' => 180,
-  'Height' => 287,
-)array (
-  'key' => '06b593e9052d9d2fa7c7f7c89b4b018a',
-  'sourceFile' => 'http://print.dongerkj.com/upload/print/20200105/bca49ad95e6c89bd5c76bcd5f86c55a1.jpg',
-  'Type' => 'img',
-  'filename' => '下载.jpg',
-  'trueColor' => 'False',
-  'Copies' => 1,
-  'Landscape' => 'False',
-  'Scaling' => 'True',
-  'tasktype' => 'now',
-  'printtime' => 1578206963,
-  'callBackUrl' => 'http://print.dongerkj.com/weixin/notify/prints',
-  'leftMargin' => 10,
-  'Width' => 180,
-  'Height' => 287,
-)array (
-  'key' => '06b593e9052d9d2fa7c7f7c89b4b018a',
-  'sourceFile' => 'http://print.dongerkj.com/upload/print/20200105/bca49ad95e6c89bd5c76bcd5f86c55a1.jpg',
-  'Type' => 'img',
-  'filename' => '下载.jpg',
-  'trueColor' => 'False',
-  'Copies' => 1,
-  'Landscape' => 'False',
-  'Scaling' => 'True',
-  'tasktype' => 'now',
-  'printtime' => 1578207034,
-  'callBackUrl' => 'http://print.dongerkj.com/weixin/notify/prints',
-  'leftMargin' => 10,
-  'Width' => 180,
-  'Height' => 287,
-)array (
-  'key' => '76c3f3825b80af6a105fa709c13a3705',
-  'sourceFile' => 'http://print.dongerkj.com/upload/print/20200105/81dce53871921e6ea4e647233b233d6c.jpg',
-  'Type' => 'img',
-  'filename' => 'bca49ad95e6c89bd5c76bcd5f86c55a1.jpg',
-  'trueColor' => 'False',
-  'Copies' => 1,
-  'Landscape' => 'False',
-  'Scaling' => 'True',
-  'tasktype' => 'now',
-  'printtime' => 1578207828,
-  'callBackUrl' => 'http://print.dongerkj.com/weixin/notify/prints',
-  'leftMargin' => 10,
-  'Width' => 180,
-  'Height' => 287,
-)array (
-  'key' => '76c3f3825b80af6a105fa709c13a3705',
-  'sourceFile' => 'http://print.dongerkj.com/upload/print/20200105/81dce53871921e6ea4e647233b233d6c.jpg',
-  'Type' => 'img',
-  'filename' => 'bca49ad95e6c89bd5c76bcd5f86c55a1.jpg',
-  'trueColor' => 'False',
-  'Copies' => 1,
-  'Landscape' => 'False',
-  'Scaling' => 'True',
-  'tasktype' => 'now',
-  'printtime' => 1578208452,
-  'callBackUrl' => 'http://print.dongerkj.com/weixin/notify/prints',
-  'leftMargin' => 10,
-  'Width' => 180,
-  'Height' => 287,
-)array (
-  'key' => '76c3f3825b80af6a105fa709c13a3705',
-  'sourceFile' => 'http://print.dongerkj.com/upload/print/20200105/b523dbff5c5c6d864353dfbbb8ba3eaa.jpg',
-  'Type' => 'img',
-  'filename' => '下载 (1).jpg',
-  'trueColor' => 'True',
-  'Copies' => 1,
-  'Landscape' => 'False',
-  'Scaling' => 'True',
-  'tasktype' => 'now',
-  'printtime' => 1578208490,
-  'callBackUrl' => 'http://print.dongerkj.com/weixin/notify/prints',
-  'leftMargin' => 10,
-  'Width' => 180,
-  'Height' => 287,
-)

+ 0 - 421
public/test_task.log

@@ -1,421 +0,0 @@
-array (
-  0 => 
-  array (
-    'id' => 253,
-    'order_sn' => 'PR2001051400004115765',
-    'user_id' => 65,
-    'shop_uid' => 18,
-    'device_id' => 17,
-    'api_key' => '06b969c37f8a15931e772daf9017e3da',
-    'pid' => 388,
-    'name' => '下载 (1).jpg',
-    'url' => 'print/20200105/099c0063ff30e555e006d640f01a72c4.jpg',
-    'nums' => 1,
-    'type' => 1,
-    'file_type' => 'jpg',
-    'page_start' => 1,
-    'page_end' => 1,
-    'print_type' => 1,
-    'page_type' => 2,
-  ),
-)array (
-  0 => 
-  array (
-    'id' => 253,
-    'order_sn' => 'PR2001051400004115765',
-    'user_id' => 65,
-    'shop_uid' => 18,
-    'device_id' => 17,
-    'api_key' => '06b969c37f8a15931e772daf9017e3da',
-    'pid' => 388,
-    'name' => '下载 (1).jpg',
-    'url' => 'print/20200105/099c0063ff30e555e006d640f01a72c4.jpg',
-    'nums' => 1,
-    'type' => 1,
-    'file_type' => 'jpg',
-    'page_start' => 1,
-    'page_end' => 1,
-    'print_type' => 1,
-    'page_type' => 2,
-  ),
-)array (
-  0 => 
-  array (
-    'id' => 253,
-    'order_sn' => 'PR2001051400004115765',
-    'user_id' => 65,
-    'shop_uid' => 18,
-    'device_id' => 17,
-    'api_key' => '06b969c37f8a15931e772daf9017e3da',
-    'pid' => 388,
-    'name' => '下载 (1).jpg',
-    'url' => 'print/20200105/099c0063ff30e555e006d640f01a72c4.jpg',
-    'nums' => 1,
-    'type' => 1,
-    'file_type' => 'jpg',
-    'page_start' => 1,
-    'page_end' => 1,
-    'print_type' => 1,
-    'page_type' => 2,
-  ),
-)array (
-  0 => 
-  array (
-    'id' => 253,
-    'order_sn' => 'PR2001051400004115765',
-    'user_id' => 65,
-    'shop_uid' => 23,
-    'device_id' => 17,
-    'api_key' => '06b969c37f8a15931e772daf9017e3da',
-    'pid' => 388,
-    'name' => '下载 (1).jpg',
-    'url' => 'print/20200105/099c0063ff30e555e006d640f01a72c4.jpg',
-    'nums' => 1,
-    'type' => 1,
-    'file_type' => 'jpg',
-    'page_start' => 1,
-    'page_end' => 1,
-    'print_type' => 1,
-    'page_type' => 2,
-  ),
-)array (
-  0 => 
-  array (
-    'id' => 253,
-    'order_sn' => 'PR2001051400004115765',
-    'user_id' => 65,
-    'shop_uid' => 23,
-    'device_id' => 17,
-    'api_key' => '06b969c37f8a15931e772daf9017e3da',
-    'pid' => 388,
-    'name' => '下载 (1).jpg',
-    'url' => 'print/20200105/099c0063ff30e555e006d640f01a72c4.jpg',
-    'nums' => 1,
-    'type' => 1,
-    'file_type' => 'jpg',
-    'page_start' => 1,
-    'page_end' => 1,
-    'print_type' => 1,
-    'page_type' => 2,
-  ),
-)array (
-  0 => 
-  array (
-    'id' => 253,
-    'order_sn' => 'PR2001051400004115765',
-    'user_id' => 65,
-    'shop_uid' => 18,
-    'device_id' => 23,
-    'api_key' => '06b593e9052d9d2fa7c7f7c89b4b018a',
-    'pid' => 388,
-    'name' => '下载 (1).jpg',
-    'url' => 'print/20200105/099c0063ff30e555e006d640f01a72c4.jpg',
-    'nums' => 1,
-    'type' => 1,
-    'file_type' => 'jpg',
-    'page_start' => 1,
-    'page_end' => 1,
-    'print_type' => 1,
-    'page_type' => 2,
-  ),
-)array (
-  0 => 
-  array (
-    'id' => 254,
-    'order_sn' => 'PR2001051400006315365',
-    'user_id' => 65,
-    'shop_uid' => 18,
-    'device_id' => 23,
-    'api_key' => '06b593e9052d9d2fa7c7f7c89b4b018a',
-    'pid' => 389,
-    'name' => '下载.jpg',
-    'url' => 'print/20200105/bca49ad95e6c89bd5c76bcd5f86c55a1.jpg',
-    'nums' => 1,
-    'type' => 1,
-    'file_type' => 'jpg',
-    'page_start' => 1,
-    'page_end' => 1,
-    'print_type' => 1,
-    'page_type' => 2,
-  ),
-)array (
-  0 => 
-  array (
-    'id' => 254,
-    'order_sn' => 'PR2001051400006315365',
-    'user_id' => 65,
-    'shop_uid' => 18,
-    'device_id' => 23,
-    'api_key' => '06b593e9052d9d2fa7c7f7c89b4b018a',
-    'pid' => 389,
-    'name' => '下载.jpg',
-    'url' => 'print/20200105/bca49ad95e6c89bd5c76bcd5f86c55a1.jpg',
-    'nums' => 1,
-    'type' => 1,
-    'file_type' => 'jpg',
-    'page_start' => 1,
-    'page_end' => 1,
-    'print_type' => 1,
-    'page_type' => 2,
-  ),
-)array (
-  0 => 
-  array (
-    'id' => 254,
-    'order_sn' => 'PR2001051400006315365',
-    'user_id' => 65,
-    'shop_uid' => 18,
-    'device_id' => 23,
-    'api_key' => '06b593e9052d9d2fa7c7f7c89b4b018a',
-    'pid' => 389,
-    'name' => '下载.jpg',
-    'url' => 'print/20200105/bca49ad95e6c89bd5c76bcd5f86c55a1.jpg',
-    'nums' => 1,
-    'type' => 1,
-    'file_type' => 'jpg',
-    'page_start' => 1,
-    'page_end' => 1,
-    'print_type' => 1,
-    'page_type' => 2,
-  ),
-)array (
-  0 => 
-  array (
-    'id' => 254,
-    'order_sn' => 'PR2001051400006315365',
-    'user_id' => 65,
-    'shop_uid' => 18,
-    'device_id' => 23,
-    'api_key' => '06b593e9052d9d2fa7c7f7c89b4b018a',
-    'pid' => 389,
-    'name' => '下载.jpg',
-    'url' => 'print/20200105/bca49ad95e6c89bd5c76bcd5f86c55a1.jpg',
-    'nums' => 1,
-    'type' => 1,
-    'file_type' => 'jpg',
-    'page_start' => 1,
-    'page_end' => 1,
-    'print_type' => 1,
-    'page_type' => 2,
-  ),
-)array (
-  0 => 
-  array (
-    'id' => 254,
-    'order_sn' => 'PR2001051400006315365',
-    'user_id' => 65,
-    'shop_uid' => 18,
-    'device_id' => 23,
-    'api_key' => '06b593e9052d9d2fa7c7f7c89b4b018a',
-    'pid' => 389,
-    'name' => '下载.jpg',
-    'url' => 'print/20200105/bca49ad95e6c89bd5c76bcd5f86c55a1.jpg',
-    'nums' => 1,
-    'type' => 1,
-    'file_type' => 'jpg',
-    'page_start' => 1,
-    'page_end' => 1,
-    'print_type' => 1,
-    'page_type' => 2,
-  ),
-)array (
-  0 => 
-  array (
-    'id' => 254,
-    'order_sn' => 'PR2001051400006315365',
-    'user_id' => 65,
-    'shop_uid' => 18,
-    'device_id' => 23,
-    'api_key' => '06b593e9052d9d2fa7c7f7c89b4b018a',
-    'pid' => 389,
-    'name' => '下载.jpg',
-    'url' => 'print/20200105/bca49ad95e6c89bd5c76bcd5f86c55a1.jpg',
-    'nums' => 1,
-    'type' => 1,
-    'file_type' => 'jpg',
-    'page_start' => 1,
-    'page_end' => 1,
-    'print_type' => 1,
-    'page_type' => 2,
-  ),
-)array (
-  0 => 
-  array (
-    'id' => 254,
-    'order_sn' => 'PR2001051400006315365',
-    'user_id' => 65,
-    'shop_uid' => 18,
-    'device_id' => 23,
-    'api_key' => '06b593e9052d9d2fa7c7f7c89b4b018a',
-    'pid' => 389,
-    'name' => '下载.jpg',
-    'url' => 'print/20200105/bca49ad95e6c89bd5c76bcd5f86c55a1.jpg',
-    'nums' => 1,
-    'type' => 1,
-    'file_type' => 'jpg',
-    'page_start' => 1,
-    'page_end' => 1,
-    'print_type' => 1,
-    'page_type' => 2,
-  ),
-)array (
-  0 => 
-  array (
-    'id' => 254,
-    'order_sn' => 'PR2001051400006315365',
-    'user_id' => 65,
-    'shop_uid' => 18,
-    'device_id' => 23,
-    'api_key' => '06b593e9052d9d2fa7c7f7c89b4b018a',
-    'pid' => 389,
-    'name' => '下载.jpg',
-    'url' => 'print/20200105/bca49ad95e6c89bd5c76bcd5f86c55a1.jpg',
-    'nums' => 1,
-    'type' => 1,
-    'file_type' => 'jpg',
-    'page_start' => 1,
-    'page_end' => 1,
-    'print_type' => 1,
-    'page_type' => 2,
-  ),
-)array (
-  0 => 
-  array (
-    'id' => 256,
-    'order_sn' => 'PR2001051500007034365',
-    'user_id' => 65,
-    'shop_uid' => 18,
-    'device_id' => 24,
-    'api_key' => '76c3f3825b80af6a105fa709c13a3705',
-    'pid' => 391,
-    'name' => 'bca49ad95e6c89bd5c76bcd5f86c55a1.jpg',
-    'url' => 'print/20200105/81dce53871921e6ea4e647233b233d6c.jpg',
-    'nums' => 1,
-    'type' => 1,
-    'file_type' => 'jpg',
-    'page_start' => 1,
-    'page_end' => 1,
-    'print_type' => 1,
-    'page_type' => 2,
-  ),
-)array (
-  0 => 
-  array (
-    'id' => 256,
-    'order_sn' => 'PR2001051500007034365',
-    'user_id' => 65,
-    'shop_uid' => 18,
-    'device_id' => 24,
-    'api_key' => '76c3f3825b80af6a105fa709c13a3705',
-    'pid' => 391,
-    'name' => 'bca49ad95e6c89bd5c76bcd5f86c55a1.jpg',
-    'url' => 'print/20200105/81dce53871921e6ea4e647233b233d6c.jpg',
-    'nums' => 1,
-    'type' => 1,
-    'file_type' => 'jpg',
-    'page_start' => 1,
-    'page_end' => 1,
-    'print_type' => 1,
-    'page_type' => 2,
-  ),
-)array (
-  0 => 
-  array (
-    'id' => 257,
-    'order_sn' => 'PR20010515000010144565',
-    'user_id' => 65,
-    'shop_uid' => 18,
-    'device_id' => 24,
-    'api_key' => '76c3f3825b80af6a105fa709c13a3705',
-    'pid' => 392,
-    'name' => '下载 (1).jpg',
-    'url' => 'print/20200105/b523dbff5c5c6d864353dfbbb8ba3eaa.jpg',
-    'nums' => 1,
-    'type' => 1,
-    'file_type' => 'jpg',
-    'page_start' => 1,
-    'page_end' => 1,
-    'print_type' => 2,
-    'page_type' => 2,
-  ),
-)array (
-  0 => 
-  array (
-    'id' => 263,
-    'order_sn' => 'PR2002131400006482665',
-    'user_id' => 65,
-    'shop_uid' => 3,
-    'device_id' => 21,
-    'api_key' => '4564565464',
-    'pid' => 398,
-    'name' => 'u=136104178,4278330209&fm=26&gp=0.jpg',
-    'url' => 'print/20200213/a0f2e2da217329e5c03f17e0273c734c.jpg',
-    'nums' => 1,
-    'type' => 1,
-    'file_type' => 'jpg',
-    'page_start' => 1,
-    'page_end' => 1,
-    'print_type' => 1,
-    'page_type' => 2,
-  ),
-)array (
-  0 => 
-  array (
-    'id' => 263,
-    'order_sn' => 'PR2002131400006482665',
-    'user_id' => 65,
-    'shop_uid' => 3,
-    'device_id' => 21,
-    'api_key' => '4564565464',
-    'pid' => 398,
-    'name' => 'u=136104178,4278330209&fm=26&gp=0.jpg',
-    'url' => 'print/20200213/a0f2e2da217329e5c03f17e0273c734c.jpg',
-    'nums' => 1,
-    'type' => 1,
-    'file_type' => 'jpg',
-    'page_start' => 1,
-    'page_end' => 1,
-    'print_type' => 1,
-    'page_type' => 2,
-  ),
-)array (
-  0 => 
-  array (
-    'id' => 263,
-    'order_sn' => 'PR2002131400006482665',
-    'user_id' => 65,
-    'shop_uid' => 3,
-    'device_id' => 21,
-    'api_key' => '4564565464',
-    'pid' => 398,
-    'name' => 'u=136104178,4278330209&fm=26&gp=0.jpg',
-    'url' => 'print/20200213/a0f2e2da217329e5c03f17e0273c734c.jpg',
-    'nums' => 1,
-    'type' => 1,
-    'file_type' => 'jpg',
-    'page_start' => 1,
-    'page_end' => 1,
-    'print_type' => 1,
-    'page_type' => 2,
-  ),
-)array (
-  0 => 
-  array (
-    'id' => 263,
-    'order_sn' => 'PR2002131400006482665',
-    'user_id' => 65,
-    'shop_uid' => 3,
-    'device_id' => 21,
-    'api_key' => '4564565464',
-    'pid' => 398,
-    'name' => 'u=136104178,4278330209&fm=26&gp=0.jpg',
-    'url' => 'print/20200213/a0f2e2da217329e5c03f17e0273c734c.jpg',
-    'nums' => 1,
-    'type' => 1,
-    'file_type' => 'jpg',
-    'page_start' => 1,
-    'page_end' => 1,
-    'print_type' => 1,
-    'page_type' => 2,
-  ),
-)

+ 0 - 0
public/upload/print/20200213/color_38dfff66ab13b616aff1a76bb9f7c233.jpg


二進制
public/upload/print/20200213/color_bb85fca6fb212254b90d3c934f4d868c.jpg


+ 1 - 1
vendor/thinkcmf/cmf-app/src/weixin/controller/NotifyController.php

@@ -243,7 +243,7 @@ class NotifyController extends Controller
      */
     public function prints(){
         $params = input();
-        file_put_contents('result.log', var_export($params, true), 8);
+        saveLogCache('prints:notify', $params);
         $taskId = isset($params['taskID'])? $params['taskID'] : '';
         $status = isset($params['status'])? $params['status'] : '';
         if($status == 'success'){

+ 77 - 74
vendor/thinkcmf/cmf-app/src/weixin/controller/TaskController.php

@@ -1,4 +1,5 @@
 <?php
+
 namespace app\weixin\controller;
 
 use app\weixin\model\Devices;
@@ -12,48 +13,49 @@ class TaskController extends Controller
      * @throws \think\Exception
      * @throws \think\exception\PDOException
      */
-    public function prints(){
-        $orderSn = input('sn','');
-        saveLogCache('Task:params:'.$orderSn, input());
-        if(empty($orderSn)){
+    public function prints()
+    {
+        $orderSn = input('sn', '');
+        saveLogCache('Task:params:' . $orderSn, input());
+        if (empty($orderSn)) {
             showJson('error', 3016);
         }
-        $info = db('orders')->where(['order_sn'=> $orderSn])->field('id,status')->find();
-        $orderStatus = isset($info['status'])? $info['status'] : 0;
-        if(empty($info) || $orderStatus != 2){
-            $msg = 4010+$orderStatus;
-            showJson('error',$msg);
+        $info = db('orders')->where(['order_sn' => $orderSn])->field('id,status')->find();
+        $orderStatus = isset($info['status']) ? $info['status'] : 0;
+        if (empty($info) || $orderStatus != 2) {
+            $msg = 4010 + $orderStatus;
+            showJson('error', $msg);
         }
 
         $printList = db('orders')->alias('o')
-            ->join('print_files pf','pf.order_id=o.id','left')
-            ->join('devices d','d.id=o.device_id','left')
-            ->where(['o.order_sn'=> $orderSn, 'o.status'=> 2])
+            ->join('print_files pf', 'pf.order_id=o.id', 'left')
+            ->join('devices d', 'd.id=o.device_id', 'left')
+            ->where(['o.order_sn' => $orderSn, 'o.status' => 2])
             ->field('o.id,o.order_sn,o.user_id,o.shop_uid,o.device_id,d.api_key,pf.id as pid,pf.name,pf.url,pf.nums,pf.type,pf.file_type,pf.page_start,pf.page_end,pf.print_type,pf.page_type')
             ->order('pf.id')
             ->select()
             ->toArray();
-        saveLogCache('Task:printList:'.$orderSn, $printList);
-        if(empty($printList) || $printList == null){
-            showJson('error',3010);
+        saveLogCache('Task:printList:' . $orderSn, $printList);
+        if (empty($printList) || $printList == null) {
+            showJson('error', 3010);
         }
 
         // 调用打印
         // file_put_contents('test_task.log', var_export($printList, true), 8);
-        $successArr  = [];
-        foreach ($printList as $item){
-            $pid = isset($item['pid'])? intval($item['pid']) : 0;
-            $apiKey = isset($item['api_key'])? trim($item['api_key']) : '';
+        $successArr = [];
+        foreach ($printList as $item) {
+            $pid = isset($item['pid']) ? intval($item['pid']) : 0;
+            $apiKey = isset($item['api_key']) ? trim($item['api_key']) : '';
             $result = Devices::printFile($pid, $apiKey, $item);
-            $code = isset($result['code'])? $result['code'] : '';
-            $msg = isset($result['message'])? $result['message'] : '';
-            if($code != 'success'){
-                showJson('error',$msg? $msg:3020);
+            $code = isset($result['code']) ? $result['code'] : '';
+            $msg = isset($result['message']) ? $result['message'] : '';
+            if ($code != 'success') {
+                showJson('error', $msg ? $msg : 3020);
             }
             $successArr[] = $result;
         }
-        saveLogCache('Task:printResult:'.$orderSn, $successArr);
-        showJson('success',3015, $successArr);
+        saveLogCache('Task:printResult:' . $orderSn, $successArr);
+        showJson('success', 3015, $successArr);
     }
 
     /**
@@ -61,91 +63,92 @@ class TaskController extends Controller
      * @throws \think\Exception
      * @throws \think\exception\PDOException
      */
-    public function catchOrder(){
+    public function catchOrder()
+    {
         try {
-            $key = input('key','');
+            $key = input('key', '');
             $checkKey = config('task.key');
-            if($key != $checkKey){
-                showJson('error',2009,'',"\n");
+            if ($key != $checkKey) {
+                showJson('error', 2009, '', "\n");
             }
 
             $cancelTime = config('task.orderCancelTime');
             $expireTime = config('task.orderExpireTime');
-            $cancelTime = $cancelTime? $cancelTime*60 : 30*60;
-            $expireTime = $expireTime? $expireTime*60 : 120*60;
+            $cancelTime = $cancelTime ? $cancelTime * 60 : 30 * 60;
+            $expireTime = $expireTime ? $expireTime * 60 : 120 * 60;
             // 未支付
-            db('orders')->where(['status'=>1])
-                ->where('created_at','<=',date('Y-m-d H:i:s',time()-$cancelTime))
-                ->update(['status'=>5,'remark'=>'超时自动取消']);
+            db('orders')->where(['status' => 1])
+                ->where('created_at', '<=', date('Y-m-d H:i:s', time() - $cancelTime))
+                ->update(['status' => 5, 'remark' => '超时自动取消']);
 
             // 已取消的删除
-            db('orders')->where(['status'=>5])
-                ->where('created_at','<=',date('Y-m-d H:i:s', time()-7*24*3600))
+            db('orders')->where(['status' => 5])
+                ->where('created_at', '<=', date('Y-m-d H:i:s', time() - 7 * 24 * 3600))
                 ->delete();
 
             // 已付款未打印订单取消
-            $orderList = db('orders')->where(['status'=>2])
-                ->where(['is_lock'=>0])
-                ->where('pay_at','<=',date('Y-m-d H:i:s', time()-$expireTime))
+            $orderList = db('orders')->where(['status' => 2])
+                ->where(['is_lock' => 0])
+                ->where('pay_at', '<=', date('Y-m-d H:i:s', time() - $expireTime))
                 ->field('id,order_sn,user_id,transaction_id,pay_total,pay_at')
                 ->select()
                 ->toArray();
-            if(empty($orderList)){
-                return showJson('error','暂无已支付未打印订单处理','',"\n");
+            if (empty($orderList)) {
+                return showJson('error', '暂无已支付未打印订单处理', '', "\n");
             }
 
             // 更新锁状态
-            db('orders')->where(['status'=>2])
-                ->where(['is_lock'=>0])
-                ->where('pay_at','<=',date('Y-m-d H:i:s', time()-$expireTime))
-                ->update(['is_lock'=>1,'updated_at'=>date('Y-m-d H:i:s')]);
+            db('orders')->where(['status' => 2])
+                ->where(['is_lock' => 0])
+                ->where('pay_at', '<=', date('Y-m-d H:i:s', time() - $expireTime))
+                ->update(['is_lock' => 1, 'updated_at' => date('Y-m-d H:i:s')]);
             $count = 0;
-            foreach($orderList as $order){
-                $orderId = isset($order['id'])? $order['id'] : 0;
-                $userId = isset($order['user_id'])? $order['user_id'] : 0;
-                $orderSn = isset($order['order_sn'])? $order['order_sn'] : '';
-                $payTotal = isset($order['pay_total'])? $order['pay_total'] : 0;
-                $transactionId = isset($order['transaction_id'])? $order['transaction_id'] : '';
-                if($payTotal && $userId){
-                    $balance = Member::where(['id'=> $userId])->value('balance');
+            foreach ($orderList as $order) {
+                $orderId = isset($order['id']) ? $order['id'] : 0;
+                $userId = isset($order['user_id']) ? $order['user_id'] : 0;
+                $orderSn = isset($order['order_sn']) ? $order['order_sn'] : '';
+                $payTotal = isset($order['pay_total']) ? $order['pay_total'] : 0;
+                $transactionId = isset($order['transaction_id']) ? $order['transaction_id'] : '';
+                if ($payTotal && $userId) {
+                    $balance = Member::where(['id' => $userId])->value('balance');
                     $updateData = [
-                        'balance'=> moneyFormat($balance+$payTotal, 2),
-                        'updated_at'=> date('Y-m-d H:i:s'),
+                        'balance' => moneyFormat($balance + $payTotal, 2),
+                        'updated_at' => date('Y-m-d H:i:s'),
                     ];
                     db('user')->startTrans();
-                    if(db('user')->where(['id'=> $userId])->update($updateData)){
-                        $payAt = isset($order['pay_at'])? $order['pay_at'] : '';
+                    if (db('user')->where(['id' => $userId])->update($updateData)) {
+                        $payAt = isset($order['pay_at']) ? $order['pay_at'] : '';
                         $log = [
-                            'type'=> 1,
-                            'change_type'=> 3,
-                            'user_id'=> $userId,
-                            'create_time'=> time(),
-                            'change'=> moneyFormat($payTotal, 2),
-                            'balance'=> $balance,
-                            'description'=> '订单号:'.$orderSn.',交易单号:'.$transactionId.',交易时间: '.$payAt,
-                            'remark'=> '订单已支付未打印超时退款',
-                            'status'=>2
+                            'type' => 1,
+                            'change_type' => 3,
+                            'user_id' => $userId,
+                            'create_time' => time(),
+                            'change' => moneyFormat($payTotal, 2),
+                            'balance' => $balance,
+                            'description' => '订单号:' . $orderSn . ',交易单号:' . $transactionId . ',交易时间: ' . $payAt,
+                            'remark' => '订单已支付未打印超时退款',
+                            'status' => 2
                         ];
 
                         $res = db('user_balance_log')->insertGetId($log);
-                        if(!$res){
+                        if (!$res) {
                             db('user')->rollback();
                             continue;
                         }
                     }
 
                     $count++;
-                    db('orders')->where(['status'=>2,'id'=> $orderId])
-                        ->update(['status'=>5,'remark'=>'订单已退款','is_lock'=>0,'updated_at'=>date('Y-m-d H:i:s')]);
+                    db('orders')->where(['status' => 2, 'id' => $orderId])
+                        ->update(['status' => 5, 'remark' => '订单已退款', 'is_lock' => 0, 'updated_at' => date('Y-m-d H:i:s')]);
                     db('user')->commit();
                 }
             }
 
-            $result = count($orderList)<=100? $orderList : [];
-            $msg = "订单退款已处理成功,累计".count($orderList)."个订单,成功处理{$count}个";
-            return showJson('success',$msg, $result,"\n");
-        } catch (\Exception $exception){
-            return showJson('error', $exception->getMessage(), '',"\n");
+            $result = count($orderList) <= 100 ? $orderList : [];
+            $msg = "订单退款已处理成功,累计" . count($orderList) . "个订单,成功处理{$count}个";
+            return showJson('success', $msg, $result, "\n");
+        } catch (\Exception $exception) {
+            return showJson('error', $exception->getMessage(), '', "\n");
         }
 
     }

+ 80 - 74
vendor/thinkcmf/cmf-app/src/weixin/model/Devices.php

@@ -1,5 +1,7 @@
 <?php
+
 namespace app\weixin\model;
+
 use cmf\phpqrcode\QRcode;
 use think\Model;
 
@@ -17,7 +19,7 @@ class Devices extends Model
      * @throws \think\db\exception\ModelNotFoundException
      * @throws \think\exception\DbException
      */
-    public static function getDeviceList($params, $pageSize=30)
+    public static function getDeviceList($params, $pageSize = 30)
     {
         $where = ['m.user_status' => 1];
         $lng = isset($params['lng']) ? floatval($params['lng']) : 0;
@@ -32,12 +34,12 @@ class Devices extends Model
             ->field("m.id,s.name as shop_name,d.name as device_name,d.device_code,s.business_project,s.intro,s.contact_name,s.mobile,s.logo as thumb,d.lng,d.color_type,d.lat,distance('{$lng}','{$lat}',d.`lng`,d.`lat`) as dists, d.address as d_address, s.address")
             ->where(function ($query) use ($lng, $lat, $distance) {
                 if ($lng && $lat && $distance) {
-                    return $query->where('','exp', db()->raw("{$distance} >= distance('{$lng}','{$lat}',d.`lng`,d.`lat`)  "));
+                    return $query->where('', 'exp', db()->raw("{$distance} >= distance('{$lng}','{$lat}',d.`lng`,d.`lat`)  "));
                 }
             })
             ->where($where)
-            ->where('d.lng','not null', '')
-            ->where('d.lat','>', 0)
+            ->where('d.lng', 'not null', '')
+            ->where('d.lat', '>', 0)
             ->where(function ($query) use ($keyword) {
                 if ($keyword) {
                     return $query->where('s.name', 'like', "%{$keyword}%");
@@ -61,18 +63,19 @@ class Devices extends Model
      * @param bool $refresh 是否重新生成
      * @return bool
      */
-    public static function makeQrcode($id, $refresh=false, $size=6){
+    public static function makeQrcode($id, $refresh = false, $size = 6)
+    {
 
         $qrFile = '/upload/qrcode/device/';
-        if(!is_dir($qrFile)){
-            @mkdir('.'.$qrFile, 0755, true);
+        if (!is_dir($qrFile)) {
+            @mkdir('.' . $qrFile, 0755, true);
         }
-        $qrFile = $qrFile.'C_'.$id.'_'.strtoupper(md5($id.'_'.$size)).'.jpg';
-        if(is_file($qrFile) && !$refresh){
+        $qrFile = $qrFile . 'C_' . $id . '_' . strtoupper(md5($id . '_' . $size)) . '.jpg';
+        if (is_file($qrFile) && !$refresh) {
             return false;
         }
 
-        QRcode::png($id, '.'.$qrFile,3,$size);
+        QRcode::png($id, '.' . $qrFile, 3, $size);
         return $qrFile;
     }
 
@@ -82,85 +85,87 @@ class Devices extends Model
      * @param $file 打印文件信息
      * @return array|mixed
      */
-    public static function printFile($fid, $apiKey, $file){
+    public static function printFile($fid, $apiKey, $file)
+    {
         set_time_limit(0);
         // 文件类型
-        file_put_contents('color.log', var_export($file, true),8);
-        $type = isset($file['type'])? $file['type'] : 0;
-        $fileUrl = isset($file['url'])? trim($file['url']) : '';
-        $printType = isset($file['print_type'])? intval($file['print_type']) : 1;
-        if(in_array($type, [1,3])){
+        file_put_contents('color.log', var_export($file, true), 8);
+        $type = isset($file['type']) ? $file['type'] : 0;
+        $fileUrl = isset($file['url']) ? trim($file['url']) : '';
+        $printType = isset($file['print_type']) ? intval($file['print_type']) : 1;
+        if (in_array($type, [1, 3])) {
             // 黑白
-            if($printType == 1 && $fileUrl){
-                $fileUrl = Stroage::filtterColor($fileUrl);
-                file_put_contents('color.log', var_export($fileUrl, true),8);
+            if ($printType == 1 && $fileUrl) {
+                $file['url'] = Stroage::filtterColor($fileUrl);
             }
         }
-        if(empty($file)){
-            return ['code'=>'error','message'=> lang(3010)];
+        if (empty($file)) {
+            return ['code' => 'error', 'message' => lang(3010)];
         }
 
-        $fileUrl = $fileUrl? cmf_get_image_preview_url($file['url']) : '';
-        if(empty($fileUrl) || !file_exists(UPLOAD_PATH.$file['url'])){
-            return ['code'=>'error','message'=> lang(3010)];
+        echo file_exists('upload/' . $file['url']);
+        $fileUrl = $file['url'] ? cmf_get_image_preview_url($file['url']) : '';
+        if (empty($fileUrl) || !file_exists('upload/' . $file['url'])) {
+            return ['code' => 'error', 'message' => lang(3010)];
         }
 
 
-        $fileType = isset($file['file_type'])? $file['file_type'] : '';
-        $fileType = $type == 1 || $type == 3? 'img' : $fileType;
+        $fileType = isset($file['file_type']) ? $file['file_type'] : '';
+        $fileType = $type == 1 || $type == 3 ? 'img' : $fileType;
 
         $types = config('print.types');
-        $types= $types? $types : 'img,pdf,html,doc,docx,xls,xlsx,ppt,pptx';
+        $types = $types ? $types : 'img,pdf,html,doc,docx,xls,xlsx,ppt,pptx';
         $types = explode(',', $types);
-        if(!in_array($fileType, $types)){
-            return ['code'=>'error','message'=> lang(3011)];
+        if (!in_array($fileType, $types)) {
+            return ['code' => 'error', 'message' => lang(3011)];
         }
 
-        if(in_array($fileType, ['doc','docx','xls','xlsx'])){
-            $fileUrl = str_replace('.pdf', '.'.$fileType , $fileUrl);
+        if (in_array($fileType, ['doc', 'docx', 'xls', 'xlsx'])) {
+            $fileUrl = str_replace('.pdf', '.' . $fileType, $fileUrl);
         }
 
 
-        $filename = isset($file['name'])? $file['name'] : '';
-        $nums = isset($file['nums'])? intval($file['nums']) : 0;
-        if($nums<=0){
-            return ['code'=>'error','message'=> lang(3012)];
+        $filename = isset($file['name']) ? $file['name'] : '';
+        $nums = isset($file['nums']) ? intval($file['nums']) : 0;
+        if ($nums <= 0) {
+            return ['code' => 'error', 'message' => lang(3012)];
         }
 
 
-        $printType = $printType==1? 'False' : 'True';
-        if(empty($apiKey)){
-            return ['code'=>'error','message'=> lang(3013)];
+        $printType = $printType == 1 ? 'False' : 'True';
+        if (empty($apiKey)) {
+            return ['code' => 'error', 'message' => lang(3013)];
         }
 
         $apiUrl = config('print.apiUrl');
-        if(empty($apiUrl)){
-            return ['code'=>'error','message'=> lang(3014)];
+        if (empty($apiUrl)) {
+            return ['code' => 'error', 'message' => lang(3014)];
         }
 
         $pageWidth = 0;
         $pageHeight = 0;
         $leftMargin = '31.8';
         $topMargin = '25.4';
-        if($type == 1){
+        if ($type == 1) {
             $leftMargin = 10;
             $topMargin = 0;   // 15
             $pageWidth = 180;  // 184
-        	$pageHeight = 287;
+            $pageHeight = 287;
         }
-        
-        if($type == 3){
+
+        if ($type == 3) {
             $leftMargin = 0;
             $topMargin = 0;
         }
-
+        echo $fileUrl;
+        echo "<img src='{$fileUrl}'>";
         $notifyUrl = config('print.notifyUrl');
-        $notifyUrl = $notifyUrl? $notifyUrl : '/weixin/notify/prints';
-        $notifyUrl = request()->domain().$notifyUrl;
+        $notifyUrl = $notifyUrl ? $notifyUrl : '/weixin/notify/prints';
+        $notifyUrl = request()->domain() . $notifyUrl;
         $params = [
-            "key"=> $apiKey,
-            "sourceFile"=> $fileUrl,
-            "Type"=> $fileType, //支持的类型:img,pdf,html,doc,docx,xls,xlsx,ppt,pptx
+            "key" => $apiKey,
+            "sourceFile" => $fileUrl,
+            "Type" => $fileType, //支持的类型:img,pdf,html,doc,docx,xls,xlsx,ppt,pptx
             "filename" => $filename,
             "trueColor" => $printType,//是否彩色打印,取值:True或False
             "Copies" => $nums,//打印份数,取值:1~100
@@ -177,30 +182,30 @@ class Devices extends Model
             "callBackUrl" => $notifyUrl
         ];
 
-        if($topMargin){
+        if ($topMargin) {
             $params['topMargin'] = $topMargin;
         }
 
-        if($leftMargin){
+        if ($leftMargin) {
             $params['leftMargin'] = $leftMargin;
         }
-        
-        if($pageWidth){
-        	$params['Width'] = $pageWidth;	
+
+        if ($pageWidth) {
+            $params['Width'] = $pageWidth;
         }
-        
-        if($pageHeight){
-        	$params['Height'] = $pageHeight;	
+
+        if ($pageHeight) {
+            $params['Height'] = $pageHeight;
         }
 
         // 发起请求
-        file_put_contents('test_print.log', var_export($params, true), 8);
-        $res = httpRequest($apiUrl, $params,'post','array',300);
-        $taskId = isset($res['taskID'])? $res['taskID'] : '';
-        db('print_files')->where(['id'=> $fid])->update(['task_id'=> $taskId,'print_result'=> json_encode($res, 256),'updated_at'=> date('Y-m-d H:i:s')]);
-        $code = isset($res['result'])? $res['result'] : '';
-        $msg = isset($res['msg'])? $res['msg'] : 3020;
-        return ['code'=> $code, 'message'=> $msg];
+        file_put_contents('logs/test_print.log', var_export($params, true), 8);
+        $res = httpRequest($apiUrl, $params, 'post', 'array', 300);
+        $taskId = isset($res['taskID']) ? $res['taskID'] : '';
+        db('print_files')->where(['id' => $fid])->update(['task_id' => $taskId, 'print_result' => json_encode($res, 256), 'updated_at' => date('Y-m-d H:i:s')]);
+        $code = isset($res['result']) ? $res['result'] : '';
+        $msg = isset($res['msg']) ? $res['msg'] : 3020;
+        return ['code' => $code, 'message' => $msg];
     }
 
 
@@ -212,25 +217,26 @@ class Devices extends Model
      * @throws \think\db\exception\ModelNotFoundException
      * @throws \think\exception\DbException
      */
-    public static function checkDeviceState($apiKey){
-        if(empty($apiKey)){
+    public static function checkDeviceState($apiKey)
+    {
+        if (empty($apiKey)) {
             return false;
         }
 
         $checkOpen = config('print.checkState');
-        if(empty($checkOpen)){
+        if (empty($checkOpen)) {
             return true;
         }
 
         $apiUrl = config('print.apiUrl');
-        if(empty($apiUrl)){
-            return ['code'=>'error','message'=> lang(3014)];
+        if (empty($apiUrl)) {
+            return ['code' => 'error', 'message' => lang(3014)];
         }
 
-        $result = httpRequest($apiUrl.'state/',['key'=> $apiKey],'post','array',300);
-        $onlineState = isset($result['online'])? $result['online'] : '';
-        $state = isset($result['state'])? $result['state'] : '';
-        if($onlineState == false || $state == false){
+        $result = httpRequest($apiUrl . 'state/', ['key' => $apiKey], 'post', 'array', 300);
+        $onlineState = isset($result['online']) ? $result['online'] : '';
+        $state = isset($result['state']) ? $result['state'] : '';
+        if ($onlineState == false || $state == false) {
             return false;
         }
 

+ 79 - 73
vendor/thinkcmf/cmf-app/src/weixin/model/Member.php

@@ -43,22 +43,22 @@ class Member extends Model
             'create_time' => time(),
         ];
         $userInfo = [];
-        if($openid){
-            $userInfo = Member::where(['openid'=> $openid])->field('id,openid,mobile')->find();
+        if ($openid) {
+            $userInfo = Member::where(['openid' => $openid])->field('id,openid,mobile')->find();
         }
 
-        $checkUseeId = isset($userInfo['id'])? $userInfo['id'] : 0;
-        $checkMobile = isset($userInfo['mobile'])? trim($userInfo['mobile']) : '';
+        $checkUseeId = isset($userInfo['id']) ? $userInfo['id'] : 0;
+        $checkMobile = isset($userInfo['mobile']) ? trim($userInfo['mobile']) : '';
         file_put_contents('test.log', var_export($userInfo, true), 8);
-        if(!$checkUseeId){
+        if (!$checkUseeId) {
             file_put_contents('test.log', var_export($data, true), 8);
             $userId = Member::insertGetId($data);
-        }else if($checkMobile != $mobile){
-            if(empty($checkMobile)){
+        } else if ($checkMobile != $mobile) {
+            if (empty($checkMobile)) {
                 file_put_contents('test.log', var_export($data, true), 8);
-                Member::where(['openid'=> $openid])->update($data);
+                Member::where(['openid' => $openid])->update($data);
                 $userId = $checkUseeId;
-            }else{
+            } else {
                 unset($data['openid']);
                 file_put_contents('test.log', var_export($data, true), 8);
                 $userId = Member::insertGetId($data);
@@ -116,7 +116,7 @@ class Member extends Model
                 $nickname = isset($wxInfo['nickname']) ? trim($wxInfo['nickname']) : $userName;
                 $sex = isset($wxInfo['sex']) ? intval($wxInfo['sex']) : 0;
 
-                if(empty($openid)){
+                if (empty($openid)) {
                     $updateData['openid'] = $curOpenId;
                 }
                 if ($headimgurl && $userInfo['avatar'] != $headimgurl) {
@@ -146,25 +146,26 @@ class Member extends Model
      * @param int $pageSize
      * @return mixed
      */
-    public static function getNoticeList($params, $pageSize=20){
+    public static function getNoticeList($params, $pageSize = 20)
+    {
         $where = [];
-        $userId = isset($params['user_id'])? $params['user_id'] : 0;
-        if($userId){
+        $userId = isset($params['user_id']) ? $params['user_id'] : 0;
+        if ($userId) {
             $where['user_id'] = $userId;
         }
 
-        $type = isset($params['type'])? $params['type'] : 0;
-        if ($type){
+        $type = isset($params['type']) ? $params['type'] : 0;
+        if ($type) {
             $where['type'] = $type;
         }
 
         $dataList = db('notices')
             ->field('id,type,user_id,title,content,created_at,status')
             ->where($where)
-            ->where('status','gt',0)
+            ->where('status', 'gt', 0)
             ->order("created_at desc")
             ->paginate($pageSize)
-            ->each(function($item,$k){
+            ->each(function ($item, $k) {
                 $item['created_at'] = date('Y-m-d H:i', strtotime($item['created_at']));
                 return $item;
             })
@@ -193,33 +194,34 @@ class Member extends Model
      * @throws \think\db\exception\ModelNotFoundException
      * @throws \think\exception\DbException
      */
-    public static function getShopList($params, $pageSize=30){
-        $where = ['m.user_type'=> 4, 'm.user_status'=> 1];
-        $lng = isset($params['lng'])? floatval($params['lng']) : 0;
-        $lat = isset($params['lat'])? floatval($params['lat']) : 0;
-        $keyword = isset($params['keyword'])? trim($params['keyword']) : '';
+    public static function getShopList($params, $pageSize = 30)
+    {
+        $where = ['m.user_type' => 4, 'm.user_status' => 1];
+        $lng = isset($params['lng']) ? floatval($params['lng']) : 0;
+        $lat = isset($params['lat']) ? floatval($params['lat']) : 0;
+        $keyword = isset($params['keyword']) ? trim($params['keyword']) : '';
         $mapConfig = config('config.map');
-        $distance = isset($mapConfig['distance'])? floatval($mapConfig['distance']) : 50000;
+        $distance = isset($mapConfig['distance']) ? floatval($mapConfig['distance']) : 50000;
         $dataList = self::alias('m')
-            ->join('shop s','s.user_id=m.id','left')
+            ->join('shop s', 's.user_id=m.id', 'left')
             ->where($where)
-            ->where(function($query) use($lng, $lat, $distance){
-                if($lng && $lat && $distance){
+            ->where(function ($query) use ($lng, $lat, $distance) {
+                if ($lng && $lat && $distance) {
                     $where["dists"] = ['elt', $distance];
 
                 }
             })
             ->where(function ($query) use ($keyword) {
-                if($keyword){
+                if ($keyword) {
                     return $query->where('s.name', 'like', "%{$keyword}%");
                 }
             })
             ->field("m.id,s.name as shop_name,s.business_project,s.intro,s.contact_name,s.mobile,s.logo as thumb,s.lng,s.lat,distance('{$lng}','{$lat}',s.`lng`,s.`lat`) as dists, s.address")
             ->order("dists")
             ->paginate($pageSize)
-            ->each(function($item, $k){
+            ->each(function ($item, $k) {
                 $item['thumb'] = isset($item['thumb']) ? cmf_get_image_preview_url($item['thumb']) : '';
-                $item['distance'] = isset($item['dists'])? moneyFormat($item['dists']/1000,2) : 0;
+                $item['distance'] = isset($item['dists']) ? moneyFormat($item['dists'] / 1000, 2) : 0;
                 return $item;
             })
             ->toArray();
@@ -232,43 +234,44 @@ class Member extends Model
      * 更新账户金额
      * @param $changeMoney 当前金额
      * @param $remark 备注信息
-     * @param int $changeType  变动类型:1-增加,2-减少
-     * @param int $type  账户类型:1-积分,2-余额
+     * @param int $changeType 变动类型:1-增加,2-减少
+     * @param int $type 账户类型:1-积分,2-余额
      * @return bool|int|string
      * @throws \think\Exception
      * @throws \think\exception\PDOException
      */
-    public static function updateAccount($userId, $changeMoney, $remark, $changeType=1, $type=1){
-        if($type == 1){
-            $userScore = Member::where(['id'=> $userId])->value('score');
+    public static function updateAccount($userId, $changeMoney, $remark, $changeType = 1, $type = 1)
+    {
+        if ($type == 1) {
+            $userScore = Member::where(['id' => $userId])->value('score');
             $money = max(0, moneyFormat($userScore - $changeMoney));
-            if(Member::where(['id'=> $userId])->update(['score'=> $money])){
+            if (Member::where(['id' => $userId])->update(['score' => $money])) {
                 $params = [
-                    'user_id'=> $userId,
-                    'change_score'=> $changeMoney,
-                    'type'=> $changeType,
-                    'score'=> $userScore,
-                    'remark'=> $remark,
-                    'updated_at'=> date('Y-m-d H:i:s'),
+                    'user_id' => $userId,
+                    'change_score' => $changeMoney,
+                    'type' => $changeType,
+                    'score' => $userScore,
+                    'remark' => $remark,
+                    'updated_at' => date('Y-m-d H:i:s'),
                 ];
                 return db('user_score_log')->insertGetId($params);
-            }else{
+            } else {
                 return false;
             }
-        }else if ($type == 2){
-            $balance = Member::where(['id'=> $userId])->value('balance');
+        } else if ($type == 2) {
+            $balance = Member::where(['id' => $userId])->value('balance');
             $money = max(0, moneyFormat($balance - $changeMoney));
-            if(Member::where(['id'=> $userId])->update(['balance'=> $money])){
+            if (Member::where(['id' => $userId])->update(['balance' => $money])) {
                 $params = [
-                    'user_id'=> $userId,
-                    'change'=> $changeMoney,
-                    'type'=> $changeType,
-                    'balance'=> $balance,
-                    'remark'=> $remark,
-                    'create_time'=> time(),
+                    'user_id' => $userId,
+                    'change' => $changeMoney,
+                    'type' => $changeType,
+                    'balance' => $balance,
+                    'remark' => $remark,
+                    'create_time' => time(),
                 ];
                 return db('user_balance_log')->insertGetId($params);
-            }else{
+            } else {
                 return false;
             }
         }
@@ -282,32 +285,33 @@ class Member extends Model
      * @param int $pageSize
      * @return mixed
      */
-    public static function getBalanceLogs($params, $pageSize=15){
+    public static function getBalanceLogs($params, $pageSize = 15)
+    {
         $where = [];
-        $userId = isset($params['user_id'])? $params['user_id'] : 0;
-        if($userId){
+        $userId = isset($params['user_id']) ? $params['user_id'] : 0;
+        if ($userId) {
             $where['user_id'] = $userId;
         }
 
-        $type = isset($params['type'])? $params['type'] : 0;
-        if($type==3){
+        $type = isset($params['type']) ? $params['type'] : 0;
+        if ($type == 3) {
             $where['change_type'] = 2;
-        }else if ($type){
+        } else if ($type) {
             $where['type'] = $type;
         }
 
         $dataList = db('user_balance_log')
             ->field('id,type,user_id,change_type,`change`,remark,create_time as time,pay_money,status')
             ->where($where)
-            ->where('status','gt',0)
-            ->where(function($query) use($type){
-                if($type != 3){
-                    return $query->where('change_type','in', [1,3,4]);
+            ->where('status', 'gt', 0)
+            ->where(function ($query) use ($type) {
+                if ($type != 3) {
+                    return $query->where('change_type', 'in', [1, 3, 4]);
                 }
             })
             ->order("create_time desc")
             ->paginate($pageSize)
-            ->each(function($item,$k){
+            ->each(function ($item, $k) {
                 $item['time'] = date('Y-m-d H:i:s', $item['time']);
                 return $item;
             })
@@ -323,16 +327,17 @@ class Member extends Model
      * @param int $pageSize
      * @return mixed
      */
-    public static function getRechargeLog($params, $pageSize=15){
+    public static function getRechargeLog($params, $pageSize = 15)
+    {
         $where = [];
-        $userId = isset($params['user_id'])? $params['user_id'] : 0;
-        if($userId){
+        $userId = isset($params['user_id']) ? $params['user_id'] : 0;
+        if ($userId) {
             $where['user_id'] = $userId;
         }
 
         $dataList = db('user_recharge_log')
             ->where($where)
-            ->where('status','gt',0)
+            ->where('status', 'gt', 0)
             ->order("created_at desc")
             ->paginate($pageSize)
             ->toArray();
@@ -346,15 +351,16 @@ class Member extends Model
      * @param int $pageSize
      * @return mixed
      */
-    public static function getScoreLogs($params, $pageSize=15){
-        $where = ['status'=>1];
-        $userId = isset($params['user_id'])? $params['user_id'] : 0;
-        if($userId){
+    public static function getScoreLogs($params, $pageSize = 15)
+    {
+        $where = ['status' => 1];
+        $userId = isset($params['user_id']) ? $params['user_id'] : 0;
+        if ($userId) {
             $where['user_id'] = $userId;
         }
 
-        $type = isset($params['type'])? $params['type'] : 0;
-        if ($type){
+        $type = isset($params['type']) ? $params['type'] : 0;
+        if ($type) {
             $where['type'] = $type;
         }
 

+ 0 - 7
vendor/thinkcmf/cmf-app/src/weixin/model/Order.php

@@ -3,13 +3,6 @@ namespace app\weixin\model;
 use think\Model;
 class Order
 {
-    /*public static function getOrderList($params, $pageSize=15){
-        $where = ['o.status'=>['in',[1,2,3,4]]];
-        $dataList = db('orders')->alias('o')
-            ->join('user u','u.id=o.user_id','left')
-            ->where($where)
-            ->
-    }*/
 
     /**
      * 获取订单列表

+ 100 - 84
vendor/thinkcmf/cmf-app/src/weixin/model/Payment.php

@@ -1,4 +1,5 @@
 <?php
+
 namespace app\weixin\model;
 class Payment
 {
@@ -7,7 +8,8 @@ class Payment
     /**
      * 返回给微信
      */
-    public static function rebackOk(){
+    public static function rebackOk()
+    {
         echo '<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>';
         exit;
     }
@@ -18,8 +20,9 @@ class Payment
      * @param $taskNo 缓存记录号:订单号
      * @param $data 缓存数据 已格式化
      */
-    public static function savePayCache($key, $taskNo, $data){
-        saveLogCache("OrderPay:jsapiNotify:{$key}:".$taskNo, $data);
+    public static function savePayCache($key, $taskNo, $data)
+    {
+        saveLogCache("OrderPay:jsapiNotify:{$key}:" . $taskNo, $data);
     }
 
     /**
@@ -28,66 +31,67 @@ class Payment
      * @param array $notifyData 回调数据
      * @return bool
      */
-    public static function catchOrder($outTradeNo, $notifyData=[]){
-        Payment::savePayCache('catchOrder',$outTradeNo, json_encode($notifyData, 256));
+    public static function catchOrder($outTradeNo, $notifyData = [])
+    {
+        Payment::savePayCache('catchOrder', $outTradeNo, json_encode($notifyData, 256));
         db()->startTrans();
         // 更新订单支付状态信息
-        $payMoney = isset($notifyData['total_fee'])? moneyFormat($notifyData['total_fee']): 0;
-        $orderPayMoney = moneyFormat($payMoney/100);
+        $payMoney = isset($notifyData['total_fee']) ? moneyFormat($notifyData['total_fee']) : 0;
+        $orderPayMoney = moneyFormat($payMoney / 100);
 
-        $orderInfo = db('orders')->where(['order_sn'=> $outTradeNo])
+        $orderInfo = db('orders')->where(['order_sn' => $outTradeNo])
             ->field('id,cluster_id,type,cluster_nums')
             ->find();
-        Payment::savePayCache('catchOrder',$outTradeNo, json_encode($orderInfo, 256));
+        Payment::savePayCache('catchOrder', $outTradeNo, json_encode($orderInfo, 256));
         $clusterStatus = 0;
-        $orderType = isset($orderInfo['type'])? intval($orderInfo['type']) : 0;
-        $clusterId = isset($orderInfo['cluster_id'])? intval($orderInfo['cluster_id']) : 0;
-        if($orderType==2 && $clusterId){
-            $clusterNums = db('orders')->where(['id'=>$clusterId])->value('cluster_nums');
-            $hasClusterNums = db('orders')->where(['cluster_id'=>$clusterId,'type'=>2,'status'=>2])
+        $orderType = isset($orderInfo['type']) ? intval($orderInfo['type']) : 0;
+        $clusterId = isset($orderInfo['cluster_id']) ? intval($orderInfo['cluster_id']) : 0;
+        if ($orderType == 2 && $clusterId) {
+            $clusterNums = db('orders')->where(['id' => $clusterId])->value('cluster_nums');
+            $hasClusterNums = db('orders')->where(['cluster_id' => $clusterId, 'type' => 2, 'status' => 2])
                 ->count('id');
-            if(($hasClusterNums+2) >= $clusterNums){
+            if (($hasClusterNums + 2) >= $clusterNums) {
                 $clusterStatus = 2;
-            }else{
+            } else {
                 $clusterStatus = 1;
             }
         }
         $updateData = [
-            'pay_type'=> isset($notifyData['pay_type'])? intval($notifyData['pay_type']) : 1,
-            'pay_total'=> $orderPayMoney,
-            'transaction_id'=> isset($notifyData['transaction_id'])? $notifyData['transaction_id'] : '',
-            'cluster_status'=> $clusterStatus,
-            'status'=> 2,
-            'pay_at'=> date('Y-m-d H:i:s'),
+            'pay_type' => isset($notifyData['pay_type']) ? intval($notifyData['pay_type']) : 1,
+            'pay_total' => $orderPayMoney,
+            'transaction_id' => isset($notifyData['transaction_id']) ? $notifyData['transaction_id'] : '',
+            'cluster_status' => $clusterStatus,
+            'status' => 2,
+            'pay_at' => date('Y-m-d H:i:s'),
         ];
 
-        Payment::savePayCache('uOrder',$outTradeNo, json_encode($updateData, 256));
-        $res = db('orders')->where(['order_sn'=> $outTradeNo])->update($updateData);
-        if(!$res){
-            Payment::savePayCache('uError',$outTradeNo, '更新订单支付数据失败');
+        Payment::savePayCache('uOrder', $outTradeNo, json_encode($updateData, 256));
+        $res = db('orders')->where(['order_sn' => $outTradeNo])->update($updateData);
+        if (!$res) {
+            Payment::savePayCache('uError', $outTradeNo, '更新订单支付数据失败');
             db()->rollback();
             return false;
         }
 
         //
-        if($orderPayMoney>0){
-            $deviceId = db('orders')->where(['order_sn'=> $outTradeNo])->value('device_id');
-            $deviceInfo = db('devices')->where(['id'=> $deviceId])->field('id,shop_uid')->find();
-            $userId = isset($deviceInfo['shop_uid'])? intval($deviceInfo['shop_uid']) : 0;
-            if($deviceInfo && $userId){
-                $balance = db('user')->where(['id'=> $userId])->value('balance');
+        if ($orderPayMoney > 0) {
+            $deviceId = db('orders')->where(['order_sn' => $outTradeNo])->value('device_id');
+            $deviceInfo = db('devices')->where(['id' => $deviceId])->field('id,shop_uid')->find();
+            $userId = isset($deviceInfo['shop_uid']) ? intval($deviceInfo['shop_uid']) : 0;
+            if ($deviceInfo && $userId) {
+                $balance = db('user')->where(['id' => $userId])->value('balance');
                 $accountData = [
-                    'type'=> 1,
-                    'user_id'=> $userId,
-                    'change'=> moneyFormat($orderPayMoney),
-                    'balance'=> $balance,
-                    'create_time'=> time(),
-                    'remark'=> '打印收入结算:单号['.$outTradeNo.'],金额'.$orderPayMoney,
+                    'type' => 1,
+                    'user_id' => $userId,
+                    'change' => moneyFormat($orderPayMoney),
+                    'balance' => $balance,
+                    'create_time' => time(),
+                    'remark' => '打印收入结算:单号[' . $outTradeNo . '],金额' . $orderPayMoney,
                 ];
-                Payment::savePayCache('oSettle',$outTradeNo.':shopUser', json_encode($accountData, 256));
-                if(db('user')->where(['id'=> $userId])->setInc('balance', moneyFormat($orderPayMoney))){
+                Payment::savePayCache('oSettle', $outTradeNo . ':shopUser', json_encode($accountData, 256));
+                if (db('user')->where(['id' => $userId])->setInc('balance', moneyFormat($orderPayMoney))) {
                     db('user_balance_log')->insertGetId($accountData);
-                }else{
+                } else {
                     db()->rollback();
                     return false;
                 }
@@ -97,96 +101,108 @@ class Payment
         db()->commit();
 
         // 发送成团消息
-        if($orderType == 2 && $clusterStatus==2 && $clusterId){
+        if ($orderType == 2 && $clusterStatus == 2 && $clusterId) {
             // 更新参团订单成团状态
-            $res = db('orders')->where(['cluster_id|id'=> $clusterId,'type'=>2,'status'=>2])->update([
-                'cluster_status'=>2,
-                'updated_at'=>date('Y-m-d H:i:s'),
-                'remark'=> '已成团',
+            $res = db('orders')->where(['cluster_id|id' => $clusterId, 'type' => 2, 'status' => 2])->update([
+                'cluster_status' => 2,
+                'updated_at' => date('Y-m-d H:i:s'),
+                'remark' => '已成团',
             ]);
 
-            if(!$res){
-                Payment::savePayCache('uError',$outTradeNo, '更新成团状态失败');
+            if (!$res) {
+                Payment::savePayCache('uError', $outTradeNo, '更新成团状态失败');
                 return false;
             }
 
             // 记录成团消息
             $logs = [];
-            $userIds = db('orders')->where(['cluster_id|id'=> $clusterId,'type'=>2,'status'=>2])
+            $userIds = db('orders')->where(['cluster_id|id' => $clusterId, 'type' => 2, 'status' => 2])
                 ->field('id,user_id,order_sn')
                 ->select();
-            foreach($userIds as $item){
-                $orderSn = isset($item['order_sn'])? $item['order_sn'] : '';
+            foreach ($userIds as $item) {
+                $orderSn = isset($item['order_sn']) ? $item['order_sn'] : '';
                 $logs[] = [
-                    'user_id'=> isset($item['user_id'])? $item['user_id'] : 0,
-                    'title'=> '订单成团通知',
-                    'source'=> isset($item['id'])? $item['id'] : 0,
-                    'content'=> '拼团订单:'.$orderSn."已成团,请于设备口处领取打印材料",
-                    'created_at'=> date('Y-m-d H:i:s')
+                    'user_id' => isset($item['user_id']) ? $item['user_id'] : 0,
+                    'title' => '订单成团通知',
+                    'source' => isset($item['id']) ? $item['id'] : 0,
+                    'content' => '拼团订单:' . $orderSn . "已成团,请于设备口处领取打印材料",
+                    'created_at' => date('Y-m-d H:i:s')
                 ];
             }
-            if($logs){
+            if ($logs) {
                 db('notices')->insertAll($logs);
             }
 
 
             // 发起打印请求
-            httpAnsycRequest(url('/weixin/task/prints','','',true),['sn'=> $outTradeNo]);
-        }else if($orderType == 1){
+            httpAnsycRequest(url('/weixin/task/prints', '', '', true), ['sn' => $outTradeNo]);
+        } else if ($orderType == 1) {
 
             // 发起打印请求
-            httpAnsycRequest(url('/weixin/task/prints','','',true),['sn'=> $outTradeNo]);
+            httpAnsycRequest(url('/weixin/task/prints', '', '', true), ['sn' => $outTradeNo]);
         }
 
         return true;
     }
 
-    public static function catchRechargeOrder($outTradeNo, $notifyData=[]){
+    /**
+     * 充值回调
+     * @param $outTradeNo
+     * @param array $notifyData
+     * @return bool
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public static function catchRechargeOrder($outTradeNo, $notifyData = [])
+    {
         db()->startTrans();
         // 更新订单支付状态信息
-        $payMoney = isset($notifyData['total_fee'])? moneyFormat($notifyData['total_fee']): 0;
-        $orderPayMoney = moneyFormat($payMoney/100);
+        $payMoney = isset($notifyData['total_fee']) ? moneyFormat($notifyData['total_fee']) : 0;
+        $orderPayMoney = moneyFormat($payMoney / 100);
 
         $orderInfo = db('user_recharge_log')
             ->where(['order_sn' => $outTradeNo])
             ->field('money,user_id,order_sn')
             ->find();
 
-        $orderSn = isset($orderInfo['order_sn'])? $orderInfo['order_sn'] : '';
-        $userId = isset($orderInfo['user_id'])? $orderInfo['user_id'] : 0;
-        $money = isset($orderInfo['money'])? $orderInfo['money'] : 0;
+        $orderSn = isset($orderInfo['order_sn']) ? $orderInfo['order_sn'] : '';
+        $userId = isset($orderInfo['user_id']) ? $orderInfo['user_id'] : 0;
+        $money = isset($orderInfo['money']) ? $orderInfo['money'] : 0;
 
         $updateData = [
-            'pay_money'=> $orderPayMoney,
-            'transaction_id'=> isset($notifyData['transaction_id'])? $notifyData['transaction_id'] : '',
-            'status'=> 2,
-            'pay_at'=> date('Y-m-d H:i:s'),
+            'pay_money' => $orderPayMoney,
+            'transaction_id' => isset($notifyData['transaction_id']) ? $notifyData['transaction_id'] : '',
+            'status' => 2,
+            'pay_at' => date('Y-m-d H:i:s'),
         ];
 
-        Payment::savePayCache('rOrder',$outTradeNo, json_encode($updateData, 256));
-        $res = db('user_recharge_log')->where(['order_sn'=> $outTradeNo])->update($updateData);
-        if(!$res){
-            Payment::savePayCache('rError',$outTradeNo, '更新充值订单支付数据失败');
+        Payment::savePayCache('rOrder', $outTradeNo, json_encode($updateData, 256));
+        $res = db('user_recharge_log')->where(['order_sn' => $outTradeNo])->update($updateData);
+        if (!$res) {
+            Payment::savePayCache('rError', $outTradeNo, '更新充值订单支付数据失败');
             db()->rollback();
             return false;
         }
 
         // 更新账户
-        if($userId && $money>0){
-            $balance = Member::where(['id'=> $userId])->value('balance');
-            if(!Member::where(['id'=> $userId])->update(['updated_at'=> date('Y-m-d H:i:s'),'balance'=> moneyFormat($balance + $money, 2)])){
+        if ($userId && $money > 0) {
+            $balance = Member::where(['id' => $userId])->value('balance');
+            if (!Member::where(['id' => $userId])->update(['updated_at' => date('Y-m-d H:i:s'), 'balance' => moneyFormat($balance + $money, 2)])) {
                 db()->rollback();
                 return false;
             }
 
             $accountData = [
-                'type'=> 1,
-                'change_type'=> 4,
-                'user_id'=> $userId,
-                'change'=> moneyFormat($orderPayMoney),
-                'balance'=> $balance,
-                'create_time'=> time(),
-                'remark'=> '微信支付充值:单号['.$outTradeNo.'],金额'.$orderPayMoney,
+                'type' => 1,
+                'change_type' => 4,
+                'user_id' => $userId,
+                'change' => moneyFormat($orderPayMoney),
+                'balance' => $balance,
+                'create_time' => time(),
+                'remark' => '微信支付充值:单号[' . $outTradeNo . '],金额' . $orderPayMoney,
             ];
             db('user_balance_log')->insertGetId($accountData);
         }

+ 122 - 107
vendor/thinkcmf/cmf-app/src/weixin/model/Stroage.php

@@ -1,5 +1,7 @@
 <?php
+
 namespace app\weixin\model;
+
 use cmf\lib\Upload;
 use think\Model;
 use think\Request;
@@ -13,30 +15,31 @@ class Stroage extends Model
      * @param $scene 应用场景
      * @return array|string
      */
-    public static function uploadImg($file, $scene='default'){
+    public static function uploadImg($file, $scene = 'default')
+    {
         $data = [];
         $path = "upload/{$scene}";
-        if(!is_dir($path)){
+        if (!is_dir($path)) {
             mkdir($path, 0755, true);
         }
         $fileSize = config('files.imageSize');
-        $fileSize = $fileSize? $fileSize*1024*1024 : 10*1024*1024;
-        $info = $file->validate(['size'=>$fileSize,'ext'=>'jpg,jpeg,png,gif'])->move('./'.$path);
-        if($info){
-            $filename = str_replace('\\','/', $info->getSaveName());
+        $fileSize = $fileSize ? $fileSize * 1024 * 1024 : 10 * 1024 * 1024;
+        $info = $file->validate(['size' => $fileSize, 'ext' => 'jpg,jpeg,png,gif'])->move('./' . $path);
+        if ($info) {
+            $filename = str_replace('\\', '/', $info->getSaveName());
             $fileInfo = $info->getInfo();
-            $name = isset($fileInfo['name'])? $fileInfo['name'] : '';
+            $name = isset($fileInfo['name']) ? $fileInfo['name'] : '';
             $fileType = cmf_get_file_extension($name);
             $data = [
-                'name'=> $name,
-                'file'=> "{$scene}/".$filename,
-                'preview'=> cmf_get_image_preview_url("{$scene}/".$filename),
-                'file_type'=> $fileType,
-                'file_size'=> isset($fileInfo['size'])? getFileSize($fileInfo['size']) : 0,
-                'md5_key'=> md5_file(cmf_get_image_preview_url("{$scene}/".$filename)),
-                'total_page'=> 1,
+                'name' => $name,
+                'file' => "{$scene}/" . $filename,
+                'preview' => cmf_get_image_preview_url("{$scene}/" . $filename),
+                'file_type' => $fileType,
+                'file_size' => isset($fileInfo['size']) ? getFileSize($fileInfo['size']) : 0,
+                'md5_key' => md5_file(cmf_get_image_preview_url("{$scene}/" . $filename)),
+                'total_page' => 1,
             ];
-        }else{
+        } else {
             return $info;
         }
         return $data;
@@ -48,34 +51,35 @@ class Stroage extends Model
      * @param string $scene
      * @return bool|int|string
      */
-    public static function uploadBaseImg($baseList, $scene='default'){
+    public static function uploadBaseImg($baseList, $scene = 'default')
+    {
         $data = [];
-        $path = "{$scene}/".date('Ymd').'/';
-        foreach($baseList as $k => $item){
-            if(!is_dir('/public/'.$path)){
-                mkdir('/public/'.$path, 755, true);
+        $path = "{$scene}/" . date('Ymd') . '/';
+        foreach ($baseList as $k => $item) {
+            if (!is_dir('/public/' . $path)) {
+                mkdir('/public/' . $path, 755, true);
             }
-            $filename = $path.'P_'.md5(uniqid().time().$k).'.jpg';
-            $src = isset($item['src'])? $item['src'] : '';
-            if($src && !preg_match("/default//", $src) && file_put_contents('/public/'.$filename, $src)){
+            $filename = $path . 'P_' . md5(uniqid() . time() . $k) . '.jpg';
+            $src = isset($item['src']) ? $item['src'] : '';
+            if ($src && !preg_match("/default//", $src) && file_put_contents('/public/' . $filename, $src)) {
                 $data[] = [
-                    'name'=> isset($item['name'])? trim($item['name']) : '',
-                    'url'=> $filename,
-                    'nums'=> isset($item['nums'])? intval($item['nums']) : 1,
-                    'total_page'=> 1,
-                    'file_size'=> isset($item['file_size'])? intval($item['file_size']) : 0,
-                    'file_type'=> isset($item['file_type'])? ltrim($item['file_type'],'image/') : '',
-                    'type'=> isset($item['type'])? trim($item['type']) : '',
-                    'md5_key'=> md5_file(cmf_get_image_preview_url($filename)),
-                    'created_at'=> date('Y-m-d H:i:s')
+                    'name' => isset($item['name']) ? trim($item['name']) : '',
+                    'url' => $filename,
+                    'nums' => isset($item['nums']) ? intval($item['nums']) : 1,
+                    'total_page' => 1,
+                    'file_size' => isset($item['file_size']) ? intval($item['file_size']) : 0,
+                    'file_type' => isset($item['file_type']) ? ltrim($item['file_type'], 'image/') : '',
+                    'type' => isset($item['type']) ? trim($item['type']) : '',
+                    'md5_key' => md5_file(cmf_get_image_preview_url($filename)),
+                    'created_at' => date('Y-m-d H:i:s')
                 ];
             }
         }
 
-        if($data){
+        if ($data) {
             return FileLogs::insertAll($data);
         } else {
-          return false;
+            return false;
         }
     }
 
@@ -85,36 +89,37 @@ class Stroage extends Model
      * @param $scene 应用场景
      * @return array|string
      */
-    public static function uploadFile($file, $scene='default'){
+    public static function uploadFile($file, $scene = 'default')
+    {
         $data = [];
         $path = "upload/files/{$scene}";
-        if(!is_dir($path)){
+        if (!is_dir($path)) {
             mkdir($path, 0755, true);
         }
         $fileTypes = config('files.fileTypes');
         $fileSize = config('files.fileSize');
-        $fileSize = $fileSize? $fileSize*1024*1024 : 30*1024*1024;
-        $fileTypes = $fileTypes? $fileTypes : ['doc','docx','xls','xlsx','ppt','pptx','pdf'];
-        $info = $file->validate(['size'=> $fileSize, 'ext'=> implode(',', $fileTypes)])->move('./'.$path);
-        if($info){
-            $filename = str_replace('\\','/', $info->getSaveName());
+        $fileSize = $fileSize ? $fileSize * 1024 * 1024 : 30 * 1024 * 1024;
+        $fileTypes = $fileTypes ? $fileTypes : ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'pdf'];
+        $info = $file->validate(['size' => $fileSize, 'ext' => implode(',', $fileTypes)])->move('./' . $path);
+        if ($info) {
+            $filename = str_replace('\\', '/', $info->getSaveName());
             $fileInfo = $info->getInfo();
-            $name = isset($fileInfo['name'])? $fileInfo['name'] : '';
+            $name = isset($fileInfo['name']) ? $fileInfo['name'] : '';
             $fileType = cmf_get_file_extension($name);
-            $file = "files/{$scene}/".$filename;
-            if(Stroage::checkFileExists($file)){
+            $file = "files/{$scene}/" . $filename;
+            if (Stroage::checkFileExists($file)) {
                 $page = Stroage::getFilePage($file);
-                if(in_array($fileType,['xls','xlsx'])){
-                    $file = str_replace('.'.$fileType,'.pdf', $file);
+                if (in_array($fileType, ['xls', 'xlsx'])) {
+                    $file = str_replace('.' . $fileType, '.pdf', $file);
                 }
                 $data = [
-                    'name'=> $name,
-                    'file'=> $file,
-                    'preview'=> cmf_get_image_preview_url($file),
-                    'file_type'=> $fileType,
-                    'file_size'=> isset($fileInfo['size'])? getFileSize($fileInfo['size']) : 0,
-                    'md5_key'=> md5_file(cmf_get_image_preview_url($file)),
-                    'total_page'=> $page,
+                    'name' => $name,
+                    'file' => $file,
+                    'preview' => cmf_get_image_preview_url($file),
+                    'file_type' => $fileType,
+                    'file_size' => isset($fileInfo['size']) ? getFileSize($fileInfo['size']) : 0,
+                    'md5_key' => md5_file(cmf_get_image_preview_url($file)),
+                    'total_page' => $page,
                 ];
             }
         }
@@ -127,8 +132,9 @@ class Stroage extends Model
      * @param $file
      * @return bool
      */
-    public static function checkFileExists($file){
-        $file = preg_match("/^files/", $file)? UPLOAD_PATH.$file : $file;
+    public static function checkFileExists($file)
+    {
+        $file = preg_match("/^files/", $file) ? UPLOAD_PATH . $file : $file;
         return is_file($file);
     }
 
@@ -138,11 +144,12 @@ class Stroage extends Model
      * @param $fileType
      * @return mixed
      */
-    public static function makeZipFile($file, $fileType){
-        $filename = str_replace('.'.$fileType,'.zip', $file);
+    public static function makeZipFile($file, $fileType)
+    {
+        $filename = str_replace('.' . $fileType, '.zip', $file);
         $zip = new \ZipArchive();
-        $file = UPLOAD_PATH.$file;
-        $zip->open(UPLOAD_PATH.$filename,\ZipArchive::CREATE);   //打开压缩包
+        $file = UPLOAD_PATH . $file;
+        $zip->open(UPLOAD_PATH . $filename, \ZipArchive::CREATE);   //打开压缩包
         $zip->addFile($file, basename($file));   //向压缩包中添加文件
         $zip->close();  //关闭压缩包
         return $filename;
@@ -154,12 +161,13 @@ class Stroage extends Model
      * @param $fileType 文件类型
      * @return bool|mixed
      */
-    public static function moveFileToZip($file, $fileType=''){
+    public static function moveFileToZip($file, $fileType = '')
+    {
         $fileType = getFileType($file);
-        $file = preg_match("/^files/", $file)? UPLOAD_PATH.$file : $file;
-        $filename = str_replace('.'.$fileType,'.zip', $file);
-        if(copy($file, $filename)){
-            return str_replace('\\','/', $filename);;
+        $file = preg_match("/^files/", $file) ? UPLOAD_PATH . $file : $file;
+        $filename = str_replace('.' . $fileType, '.zip', $file);
+        if (copy($file, $filename)) {
+            return str_replace('\\', '/', $filename);;
         }
 
         return false;
@@ -170,16 +178,17 @@ class Stroage extends Model
      * @param $file ZIP压缩文件
      * @return bool|string
      */
-    public static function getZipPageFile($file){
+    public static function getZipPageFile($file)
+    {
         $zip = new \ZipArchive();
-        $file = preg_match("/^files/", $file)? UPLOAD_PATH.$file : $file;
+        $file = preg_match("/^files/", $file) ? UPLOAD_PATH . $file : $file;
         // 中文文件名要使用ANSI编码的文件格式
         if ($zip->open($file) === TRUE) {
             //提取全部文件
-            $file = str_replace('.zip','', $file);
+            $file = str_replace('.zip', '', $file);
             $zip->extractTo($file); //提取部分文件
             $zip->close();
-            return str_replace('\\','/', $file.'/docProps/app.xml');
+            return str_replace('\\', '/', $file . '/docProps/app.xml');
         } else {
             return false;
         }
@@ -189,9 +198,10 @@ class Stroage extends Model
      * 删除文件
      * @param $file
      */
-    public static function deleteFile($file){
-        $file = preg_match("/^files/", $file)? UPLOAD_PATH.$file : $file;
-        if(is_file($file)){
+    public static function deleteFile($file)
+    {
+        $file = preg_match("/^files/", $file) ? UPLOAD_PATH . $file : $file;
+        if (is_file($file)) {
             unlink($file);
         }
     }
@@ -200,12 +210,13 @@ class Stroage extends Model
      * 删除ZIP压缩包以及其解压文件
      * @param $file 压缩奥文件
      */
-    public static function deleteZip($file){
-        if(is_file($file)){
+    public static function deleteZip($file)
+    {
+        if (is_file($file)) {
             Stroage::deleteFile($file);
         }
-        $zipDir = str_replace('.zip','', $file);
-        if(is_dir($zipDir)){
+        $zipDir = str_replace('.zip', '', $file);
+        if (is_dir($zipDir)) {
             deleteDir($zipDir);
         }
     }
@@ -215,50 +226,51 @@ class Stroage extends Model
      * @param $file 文件
      * @return int
      */
-    public static function getFilePage($file){
+    public static function getFilePage($file)
+    {
         set_time_limit(0);
         $fileType = getFileType($file);
 
         // PDF 类型文件
-        if(in_array($fileType, ['pdf'])){
+        if (in_array($fileType, ['pdf'])) {
             return Stroage::getPdfFilePage($file);
         }
 
         // 表格文件转PDF
-        if(in_array($fileType, ['xls','xlsx','doc','docx'])){
+        if (in_array($fileType, ['xls', 'xlsx', 'doc', 'docx'])) {
             $file = Stroage::convertFile($file);
             return Stroage::getPdfFilePage($file);
         }
 
         // 其他文件
         $fileTypes = config('files.fileTypes');
-        $fileTypes = $fileTypes? $fileTypes : ['doc','docx','ppt','pptx'];
-        if(!in_array($fileType, $fileTypes)){
+        $fileTypes = $fileTypes ? $fileTypes : ['doc', 'docx', 'ppt', 'pptx'];
+        if (!in_array($fileType, $fileTypes)) {
             return 0;
         }
 
         $zipFile = Stroage::moveFileToZip($file);
-        if(!is_file($zipFile)){
+        if (!is_file($zipFile)) {
             return 0;
         }
 
         // 获取页数文件内容
         $pageFile = Stroage::getZipPageFile($zipFile);
-        if(!is_file($pageFile)){
+        if (!is_file($pageFile)) {
             return 0;
         }
 
         $content = file_get_contents($pageFile);
-        if(empty($content)){
+        if (empty($content)) {
             return 0;
         }
 
         preg_match("/(<Pages>([1-9][0-9]*):?<\/Pages>)|(<Slides>([1-9][0-9]*):?<\/Slides>)|(<vt:i4>([1-9][0-9]*):?<\/vt:i4>)/", $content, $result);
-        $page = $result? intval(end($result)) : 0;
+        $page = $result ? intval(end($result)) : 0;
 
         // 删除处理生成临时压缩包文件
         $deleteTemp = config('print.deleteTemp');
-        if($deleteTemp){
+        if ($deleteTemp) {
             Stroage::deleteZip($zipFile);
         }
 
@@ -270,17 +282,18 @@ class Stroage extends Model
      * @param $file
      * @return string
      */
-    public static function filtterColor($file){
+    public static function filtterColor($file)
+    {
         $filepath = dirname($file);
         $newFile = $waterfile = $filepath . '/color_' . basename($file);
-        if(!file_exists('upload/'.$file)){
+        if (!file_exists('upload/' . $file)) {
             return false;
         }
-        // echo  $newFile;exit;
-        @fopen($newFile,'w+');
-        $im = imagecreatefromjpeg($file);
+ 
+        @fopen('upload/' . $newFile, 'w+');
+        $im = imagecreatefromjpeg('upload/' . $file);
         if ($im && imagefilter($im, IMG_FILTER_GRAYSCALE)) {
-            imagepng($im, $newFile);
+            imagepng($im, 'upload/' . $newFile);
         } else {
             $newFile = '';
         }
@@ -295,12 +308,13 @@ class Stroage extends Model
      * @param string $type 转换类型
      * @return mixed
      */
-    public static function convertFile($file, $type='pdf'){
+    public static function convertFile($file, $type = 'pdf')
+    {
         $fileType = getFileType($file);
-        $pathFile = preg_match("/^files/", $file)? UPLOAD_PATH.$file : $file;
-        $path = dirname($pathFile).'/';
-        $filename = str_replace('.'.$fileType,'.pdf', $file);
-        switch($type){
+        $pathFile = preg_match("/^files/", $file) ? UPLOAD_PATH . $file : $file;
+        $path = dirname($pathFile) . '/';
+        $filename = str_replace('.' . $fileType, '.pdf', $file);
+        switch ($type) {
             case 'pdf':
                 $command = "libreoffice6.3 --headless --invisible --convert-to pdf:writer_pdf_Export --outdir \"{$path}\" \"{$pathFile}\"";
                 exec($command);
@@ -316,23 +330,24 @@ class Stroage extends Model
      * @param $file 文件
      * @return bool|int
      */
-    public static function getPdfFilePage($file){
-        $file = preg_match("/^files/", $file)? UPLOAD_PATH.$file : $file;
-        if(!is_readable($file) || !file_exists($file)){
+    public static function getPdfFilePage($file)
+    {
+        $file = preg_match("/^files/", $file) ? UPLOAD_PATH . $file : $file;
+        if (!is_readable($file) || !file_exists($file)) {
             return 0;
         }
 
-        $max=0;
-        $fp = @fopen($file,"r");
-        if(!$fp){
+        $max = 0;
+        $fp = @fopen($file, "r");
+        if (!$fp) {
             return 0;
         }
 
-        while(!feof($fp)) {
-            $line = fgets($fp,255);
-            if (preg_match('/\/Count [0-9]+/', $line, $matches)){
-                preg_match('/[0-9]+/',$matches[0], $matches2);
-                if ($max<$matches2[0]) $max=$matches2[0];
+        while (!feof($fp)) {
+            $line = fgets($fp, 255);
+            if (preg_match('/\/Count [0-9]+/', $line, $matches)) {
+                preg_match('/[0-9]+/', $matches[0], $matches2);
+                if ($max < $matches2[0]) $max = $matches2[0];
             }
         }
 

文件差異過大導致無法顯示
+ 271 - 260
vendor/thinkcmf/cmf/src/common.php