|
@@ -29,7 +29,7 @@ class queue_logic
|
|
|
public function OpenBox($params) {
|
|
|
$postData['cabinet_code'] = $params['cabinet_code'];
|
|
|
$postData['box_position_list'] = $params['box_position_list'];
|
|
|
- $postData['delay_time'] = 0;
|
|
|
+ $postData['delay_time'] = $params['delay_time'];
|
|
|
|
|
|
$token = $this->login($params['req_url'],$params['key']);
|
|
|
if(empty($token)) {
|
|
@@ -39,7 +39,7 @@ class queue_logic
|
|
|
}
|
|
|
$resp = $this->reqest($params['req_url'] ,'/open_box', $postData,$token);
|
|
|
if(empty($resp)) {
|
|
|
- $ret = ['state'=> 1,'msg' => 'openbox fail.'];
|
|
|
+ $ret = ['code'=> 1,'msg' => 'openbox fail.'];
|
|
|
$this->sync_return($params['ret_queue'],$params['method'],$ret);
|
|
|
return $ret;
|
|
|
}
|
|
@@ -48,15 +48,23 @@ class queue_logic
|
|
|
}
|
|
|
|
|
|
public function LockCabinet($params) {
|
|
|
- $box_list[] = $params['box_number'];
|
|
|
- $postData['cabinet_code'] = $params['cabinet_number'];
|
|
|
- $postData['box_position_list'] = $box_list;
|
|
|
- $postData['delay_time'] = 0;
|
|
|
+ $postData['cabinet_code'] = $params['cabinet_code'];
|
|
|
+ $postData['delay_time'] = $params['delay_time'];
|
|
|
|
|
|
$token = $this->login($params['req_url'],$params['key']);
|
|
|
- $resp = $this->reqest($params['req_url'] ,'/open_box', $postData,$token);
|
|
|
-
|
|
|
- $this->sync_return($params['ret_queue'],$params['method'],$resp);
|
|
|
+ if(empty($token)) {
|
|
|
+ $ret = ['code'=> 1,'msg' => '柜体服务器错误'];
|
|
|
+ $this->sync_return($params['ret_queue'],$params['method'],$ret);
|
|
|
+ return $ret;
|
|
|
+ }
|
|
|
+ $resp = $this->reqest($params['req_url'] ,'/lock_cabinet', $postData,$token);
|
|
|
+ if(empty($resp)) {
|
|
|
+ $ret = ['code'=> 1,'msg' => 'lockCabinet fail.'];
|
|
|
+ $this->sync_return($params['ret_queue'],$params['method'],$ret);
|
|
|
+ return $ret;
|
|
|
+ }
|
|
|
+ $resp = $this->sync_return($params['ret_queue'],$params['method'],$resp);
|
|
|
+ return $resp;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -66,7 +74,8 @@ class queue_logic
|
|
|
$host = $config['net_queue']['host'];
|
|
|
$port = $config['net_queue']['port'];
|
|
|
try {
|
|
|
- QueueClient::push($queue_name,$host ,$port ,$key,$params);
|
|
|
+ $queuedb = new QueueDB($queue_name,$host,$port);
|
|
|
+ $queuedb->push(serialize([$key=>$params]));
|
|
|
return ['code'=>0 , 'msg' => 'ok'];
|
|
|
} catch (Exception $ex) {
|
|
|
return ['code'=>1 , 'msg' => 'cabinet redis connect error'];
|