对接积分、预存款
parent
d92929d582
commit
0569a488ad
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\API;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Exceptions\HttpResponseException;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class AspNetZhuanController extends Controller
|
||||
{
|
||||
public static $request;
|
||||
public static $JF_BaseUrl = "http://220.174.210.111:82/jifen.aspx";//积分预存款Url
|
||||
|
||||
//获取用户积分和预存款
|
||||
public static function GetJiFen_YuCunKuan($type, $ghzid)
|
||||
{
|
||||
$res = self::Get(self::$JF_BaseUrl . '?type=' . $type . '&ghzid=' . $ghzid);
|
||||
if ($type == 1) return $res['剩余积分'];
|
||||
if ($type == 2) return $res['剩余预存款'];
|
||||
}
|
||||
//获取本次账单可使用的积分和可抵扣的金额
|
||||
public static function GetEnableCount($ghzid,$ysje,$ssje)
|
||||
{
|
||||
$res = self::Get(self::$JF_BaseUrl . '?type=3' . '&ghzid=' . $ghzid. '&ysje=' . $ysje. '&ssje=' . $ssje);
|
||||
return [
|
||||
'keyong_jifen'=>$res['本次账单可抵扣积分'],
|
||||
'keyong_jine'=>$res['本次账单可抵扣金额'],
|
||||
];
|
||||
}
|
||||
public static function Get($url)
|
||||
{
|
||||
$response = Http::get($url);
|
||||
if ($response->successful()) {
|
||||
$res = $response->json();
|
||||
if ($res['code'] == "200") {
|
||||
return $res;
|
||||
} else {
|
||||
throw new HttpResponseException(\Yz::echoError1("查询用户积分预存款失败:" . $res['msg']));
|
||||
}
|
||||
} else {
|
||||
$status = $response->status();
|
||||
// 获取响应体作为字符串
|
||||
$body = $response->body();
|
||||
throw new HttpResponseException(\Yz::echoError1("查询用户积分预存款失败,status:" . $status . "body:" . $body));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue