|
|
@@ -176,6 +176,28 @@ class CardService extends BaseService
|
|
|
return message("用户卡额度更新失败", false);
|
|
|
}
|
|
|
|
|
|
+ $params = [
|
|
|
+ 'CommandType'=> 3, // 执行命令方式:3-充值,4-扣款
|
|
|
+ 'data'=> $cardInfo->code.','.$num
|
|
|
+ ];
|
|
|
+ $dataStr = [];
|
|
|
+ foreach($params as $k => $v){
|
|
|
+ $dataStr[] = $k.'='.$v;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 调用亮灯接口处理
|
|
|
+ $errorKey = "caches:cards:recharge:{$userId}";
|
|
|
+ $dataStr = implode('&', $dataStr);
|
|
|
+ $headers = ["Content-Type:application/x-www-form-urlencoded; charset=UTF-8"];
|
|
|
+ $apiUrl = ConfigService::make()->getConfigByCode('gd_api_url').'/ICcontrol.ashx';
|
|
|
+ RedisService::set($errorKey.':request', ['url'=> $apiUrl,'data'=> $params], 3600);
|
|
|
+ $result = httpHeaderRequest($apiUrl, $dataStr,'post',$headers,'text',3);
|
|
|
+ RedisService::set($errorKey.':result', ['result'=>$result], 3600);
|
|
|
+ if($result !== 0){
|
|
|
+ \DB::rollBack();
|
|
|
+ return message('充值入卡失败', false);
|
|
|
+ }
|
|
|
+
|
|
|
// 明细
|
|
|
$remark = isset($params['remark'])? $params['remark'] : '';
|
|
|
$data = [
|