|
@@ -32,9 +32,19 @@ class queue_logic
|
|
|
$postData['delay_time'] = 0;
|
|
|
|
|
|
$token = $this->login($params['req_url'],$params['key']);
|
|
|
+ if(empty($token)) {
|
|
|
+ $ret = ['code'=> 1,'msg' => '柜体服务器错误'];
|
|
|
+ $this->sync_return($params['ret_queue'],$params['method'],$ret);
|
|
|
+ return $ret;
|
|
|
+ }
|
|
|
$resp = $this->reqest($params['req_url'] ,'/open_box', $postData,$token);
|
|
|
-
|
|
|
- $this->sync_return($params['ret_queue'],$params['method'],$resp);
|
|
|
+ if(empty($resp)) {
|
|
|
+ $ret = ['state'=> 1,'msg' => 'openbox fail.'];
|
|
|
+ $this->sync_return($params['ret_queue'],$params['method'],$ret);
|
|
|
+ return $ret;
|
|
|
+ }
|
|
|
+ $resp = $this->sync_return($params['ret_queue'],$params['method'],$resp);
|
|
|
+ return $resp;
|
|
|
}
|
|
|
|
|
|
public function LockCabinet($params) {
|
|
@@ -53,9 +63,13 @@ class queue_logic
|
|
|
|
|
|
private function sync_return($queue_name,$key,$params){
|
|
|
global $config;
|
|
|
- $host = ['net_queue']['host'];
|
|
|
+ $host = $config['net_queue']['host'];
|
|
|
$port = $config['net_queue']['port'];
|
|
|
-
|
|
|
- QueueClient::push($queue_name,$host ,$port ,$key,$params);
|
|
|
+ try {
|
|
|
+ QueueClient::push($queue_name,$host ,$port ,$key,$params);
|
|
|
+ return ['code'=>0 , 'msg' => 'ok'];
|
|
|
+ } catch (Exception $ex) {
|
|
|
+ return ['code'=>1 , 'msg' => 'cabinet redis connect error'];
|
|
|
+ }
|
|
|
}
|
|
|
}
|