You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
2.4 KiB
PHP
61 lines
2.4 KiB
PHP
<?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 $res['本次账单可抵扣积分'];
|
|
}
|
|
//使用积分
|
|
public static function UseJiFen($ghzid,$jifen,$yyid,$caozuorenid,$caozuorenmigncheng,$beizhu,$dingdanshijian){
|
|
$res = self::Get(self::$JF_BaseUrl . '?type=4' . '&ghzid=' . $ghzid. '&jifen=' . $jifen.'&yyid='.$yyid.'&caozuorenid='.$caozuorenid.'&caozuorenmigncheng='.urlencode($caozuorenmigncheng).'&beizhu='.urlencode($beizhu).'&dingdanshijian='.urlencode($dingdanshijian));
|
|
return true;
|
|
}
|
|
//使用预存款
|
|
public static function UseYuCunKuan($ghzid,$yucunkuan,$yyid,$yucunkuanleixing,$caozuorenid,$caozuorenmigncheng,$beizhu,$dingdanshijian)
|
|
{
|
|
$res = self::Get(self::$JF_BaseUrl . '?type=5' . '&ghzid=' . $ghzid. '&yucunkuan=' . $yucunkuan.'&yyid='.$yyid.'&yucunkuanleixing='.$yucunkuanleixing.'&caozuorenid='.$caozuorenid.'&caozuorenmigncheng='.urlencode($caozuorenmigncheng).'&beizhu='.urlencode($beizhu).'&dingdanshijian='.urlencode($dingdanshijian));
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
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));
|
|
}
|
|
}
|
|
}
|