http上线

This commit is contained in:
“wanyongkang”
2023-12-26 16:37:09 +08:00
parent e768fdf8e1
commit 95200f1c5a
13 changed files with 1269 additions and 3 deletions

9
app/http/model/Order.php Normal file
View File

@@ -0,0 +1,9 @@
<?php
namespace app\http\model;
use fastphp\base\Model;
class Order extends Model
{
protected $table = 'http_order';
}

View File

@@ -0,0 +1,78 @@
<?php
namespace app\http\model;
use fastphp\base\Model;
use enum\http\Order as HttpOrderEnum;
class Package extends Model
{
protected $table = 'http_package';
// order_info:{
// order_type:1,//1:预储值、2短效无限量、3短效包天、4短效包量、5长效游戏
// money:1,
// pay_type:2,//1聚币 2支付宝 3微信
// data:{}
// },
public function get_price($data) {
$where = [];
if (isset($data['data']['title'])) {
unset($data['data']['title']);
}
if (isset($data['data']['packId'])) {
unset($data['data']['packId']);
}
if (isset($data['data']['packType'])) {
unset($data['data']['packType']);
}
if (isset($data['data']['ipAmount'])) {
unset($data['data']['ipAmount']);
}
if (isset($data['data']['ids'])) {
unset($data['data']['ids']);
}
switch ($data['order_type']) {
case 2:
$where = $data['data'];
$where['package_type'] = HttpOrderEnum::$dxwxl;
$where['periodAmount'] = 1;
break;
case 3:
$where = $data['data'];
$where['package_type'] = HttpOrderEnum::$dxbt;
$where['periodAmount'] = 1;
$where['ipAmount'] = 1;
break;
case 4:
$where = $data['data'];
$where['package_type'] = HttpOrderEnum::$dxbl;
unset($where['ipAmount']);
break;
case 5:
case 6:
$where = [
'periodType' => $data['data']['periodType'],
'isAbroad' => $data['data']['isAbroad'],
'shareType' => $data['data']['shareType'],
'isRelayed' => $data['data']['isRelayed'],
'lineType' => $data['data']['lineType'],
'bandwidth' => $data['data']['bandwidth'],
'package_type' => HttpOrderEnum::$cxyx
];
if ($data['data']['isAbroad'] == 0) {
unset($where['isRelayed']);
}
if ($data['data']['shareType'] == 1) {
unset($where['lineType']);
}
break;
}
$price = $this->getOne($where, 'ipAmount,price');
return $price;
}
}

View File

@@ -0,0 +1,9 @@
<?php
namespace app\http\model;
use fastphp\base\Model;
class Recharge extends Model
{
protected $table = 'http_recharge';
}

33
app/http/model/User.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
namespace app\http\model;
use fastphp\base\Model;
class User extends Model
{
// private $url_root = 'https://sandbox.sgxz.cn';
private $url_root = 'https://merchant.sgxz.cn';
protected $table = 'user';
//获取用户的http相关信息 并且初始化sgUserId
public function get_http_user($id){
$user_info = $this->getOne(['Id' => $id],'Id,sgUserId,ju_money,is_verify');
if (empty($user_info['sgUserId'])) {
$request_data = ['account' => $user_info['Id']];
$url = $this->url_root.'/register/user';
$request_data = formatHttpRequert($request_data);
$http_data = json_decode(linkcurl($url,'POST',$request_data,[],0));
$update_user_info['sgUserId'] = $user_info['sgUserId'] = $http_data->d->id;
$this->updateOne(['Id' => $id],$update_user_info);
}
return $user_info;
}
}