|
@@ -0,0 +1,50 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+use think\facade\Log;
|
|
|
+class queue_logic
|
|
|
+{
|
|
|
+ public function OpenBox($params) {
|
|
|
+ Log::record($params);
|
|
|
+ $box_list[] = $params['box_number'];
|
|
|
+ $postData['cabinet_code'] = $params['cabinet_number'];
|
|
|
+ $postData['box_position_list'] = $box_list;
|
|
|
+ $postData['delay_time'] = 0;
|
|
|
+ $return = http_post($params['req_url'] , $postData);
|
|
|
+ $return['code'] = 'ok';
|
|
|
+ if($return['code'] != 0){
|
|
|
+ $return['value'] = 'error';
|
|
|
+ }
|
|
|
+ $this->push_queue_return($params['ret_queue'] , $config['net_queue']['host'] , $config['net_queue']['port'] , $return);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function LockBox($params) {
|
|
|
+ $box_list[] = $params['box_number'];
|
|
|
+ $postData['cabinet_code'] = $params['cabinet_number'];
|
|
|
+ $postData['box_position_list'] = $box_list;
|
|
|
+ $postData['delay_time'] = 0;
|
|
|
+ $return = http_post($params['req_url'] , $postData);
|
|
|
+ $return['code'] = 'ok';
|
|
|
+ if($return['code'] != 0){
|
|
|
+ $return['value'] = 'error';
|
|
|
+ }
|
|
|
+ $this->push_queue_return($params['ret_queue'] , $config['net_queue']['host'] , $config['net_queue']['port'] , $return);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function UnLockBox($params) {
|
|
|
+ $box_list[] = $params['box_number'];
|
|
|
+ $postData['cabinet_code'] = $params['cabinet_number'];
|
|
|
+ $postData['box_position_list'] = $box_list;
|
|
|
+ $postData['delay_time'] = 0;
|
|
|
+ $return = http_post($params['req_url'] , $postData);
|
|
|
+ $return['code'] = 'ok';
|
|
|
+ if($return['code'] != 0){
|
|
|
+ $return['value'] = 'error';
|
|
|
+ }
|
|
|
+ $this->push_queue_return($params['ret_queue'] , $config['net_queue']['host'] , $config['net_queue']['port'] , $return);
|
|
|
+ }
|
|
|
+
|
|
|
+ private function push_queue_return($queue_name,$host,$port,$params){
|
|
|
+ $worker = new QueueDB($queue_name,$host,$port);
|
|
|
+ $worker->push($params);
|
|
|
+ }
|
|
|
+}
|