init: 从宝塔同步到 Gitea
This commit is contained in:
@@ -0,0 +1,264 @@
|
||||
<?php
|
||||
namespace app\onlinechip\controller;
|
||||
|
||||
use pay\Ybf;
|
||||
use think\Cache;
|
||||
use \think\Controller;
|
||||
use think\Db;
|
||||
use think\Request;
|
||||
|
||||
class Crypto Extends Controller{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* YBF支付回调
|
||||
*/
|
||||
public function callback_ybf()
|
||||
{
|
||||
$json = file_get_contents("php://input");
|
||||
$data = json_decode($json,true);
|
||||
|
||||
// 记录日志
|
||||
$logId = $this->addLog('YBF',$json);
|
||||
|
||||
$ybf = new Ybf();
|
||||
$res = $ybf->callback($data,$logId);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* YBF反查开放接口
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public function query_order_ybf()
|
||||
{
|
||||
$json = file_get_contents("php://input");
|
||||
addLogToFile('反查报文:'.$json,'ybf_fc','ybf');
|
||||
parse_str($json,$data);
|
||||
// $data = Request::instance()->request();
|
||||
|
||||
$ybf = new Ybf();
|
||||
$res = $ybf->withdraw_query($data);
|
||||
|
||||
$res = json_encode($res,JSON_UNESCAPED_UNICODE);
|
||||
addLogToFile('反查报文返回信息:'.$res,'ybf_fc','ybf');
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值回调
|
||||
*/
|
||||
public function callback()
|
||||
{
|
||||
$json = file_get_contents("php://input");
|
||||
// $json = '{"key":"transaction","merch":{"tid":1002,"user_id":1001,"type":100,"address":"TMp3mUPf4U5zsnmVSSWTHc4YQSBjxFQqbC","update_time":1681266378741,"create_time":1673600766135,"status":200},"sign":"267e31e41087f80e441bd9759fbd62fd179633b9","timestamp":1681267421305,"transaction":{"tid":1001,"type":200,"txid":"07756fb10fe41d5c342c3f79396471ce3d0d93deae2081cfe8b6e7f730492563","from_addr":"TDunwvXBwazrLdV9jPD7uy4Bq3z8Eyb4UE","to_addr":"TJtfqKmvxZTPcrQNMEoP3sPxUwbtUN8MVA","asset":"TRX","amount":"1000000","fee_energy_usage":"0","fee_energy_trx":"0","fee_net_usage":"0","fee_net_trx":"0.1","fee_used":"0.1","fee_asset":"TRX","notified":1,"update_time":1681267421298,"create_time":1681267421298,"status":200}}';
|
||||
$data = json_decode($json,true);
|
||||
|
||||
if(!empty($data)){
|
||||
$type = $data['key'];
|
||||
$uniqueNo = "";
|
||||
|
||||
// 记录日志
|
||||
$logId = $this->addLog($type,$json);
|
||||
|
||||
// 校验签名
|
||||
$verify = $this->verifySign($data);
|
||||
if($verify){
|
||||
switch ($type){
|
||||
// 充值上分
|
||||
case "transaction":
|
||||
$uniqueNo = $data['transaction']['txid'];
|
||||
$res = $this->transaction($data);
|
||||
break;
|
||||
|
||||
// 提现转账
|
||||
case "processor":
|
||||
$uniqueNo = $data['processor']['uuid'];
|
||||
$res = $this->processor($data);
|
||||
break;
|
||||
|
||||
default:
|
||||
$res = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// 更新唯一识别值
|
||||
if($uniqueNo) $this->setUniqueNo($logId,$uniqueNo);
|
||||
//if($res) return "success";
|
||||
if($res) return json_encode(['code' => 0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理交易回调
|
||||
* @param $data
|
||||
*/
|
||||
private function transaction($data)
|
||||
{
|
||||
$data = $data['transaction'];
|
||||
|
||||
// 校验状态
|
||||
$status = $data['status'];
|
||||
if($status != 200){
|
||||
return false;
|
||||
}
|
||||
|
||||
$toAddr = $data['to_addr'];
|
||||
$fromAddr = $data['from_addr'];
|
||||
$amount = $data['amount'];
|
||||
$txid = $data['txid'];
|
||||
$userId = Db::name('user_wallet')->where('address',$toAddr)->value('user_id');
|
||||
if($userId){
|
||||
Db::startTrans();
|
||||
$user = Db::name('user')->where('id',$userId)->lock(true)->find();
|
||||
$recharge = Db::name('user_recharge')->where('out_trade_no',$txid)->find();
|
||||
if($recharge){
|
||||
return false;
|
||||
}
|
||||
|
||||
// 计算兑换比率
|
||||
$system = Db::name('system')->find();
|
||||
$rechargeMoney = empty($system['recharge_money']) ? 100 : $system['recharge_money'];
|
||||
$money = $amount*($rechargeMoney/100);
|
||||
|
||||
// 上分
|
||||
$userMoney = $user['money'];
|
||||
$moneyAfter = $user['money'] + $money;
|
||||
|
||||
// 上分
|
||||
$res = Db::name('user')->where('id',$userId)->update([
|
||||
'money' => $moneyAfter,
|
||||
'last_recharge' => $money,
|
||||
'last_recharge_time' => time(),
|
||||
]);
|
||||
if(!$res) return;
|
||||
|
||||
// 充值记录
|
||||
$res = Db::name('user_recharge')->insert([
|
||||
'out_trade_no' => $txid,
|
||||
'user_id' => $userId,
|
||||
'amount' => $amount,
|
||||
'money' => $money,
|
||||
'old_money' => $userMoney,
|
||||
'new_money' => $moneyAfter,
|
||||
'from_addr' => $fromAddr,
|
||||
'to_addr' => $toAddr,
|
||||
'pay_channel' => 'USDT',
|
||||
'status' => 'SUCCESS',
|
||||
'create_time' => time(),
|
||||
'pay_time' => time(),
|
||||
]);
|
||||
if(!$res) return;
|
||||
|
||||
Db::commit();
|
||||
|
||||
return json_encode(['code' => 0]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理提现回调
|
||||
* @param $data
|
||||
*/
|
||||
private function processor($data)
|
||||
{
|
||||
$data = $data['processor'];
|
||||
|
||||
// 校验状态
|
||||
$status = $data['status'];
|
||||
if($status !== 200){
|
||||
return false;
|
||||
}
|
||||
$code = $data['result']['transfer']['code'];
|
||||
if($code !== 0){
|
||||
return false;
|
||||
}
|
||||
|
||||
$uuid = $data['uuid'];
|
||||
$fromAddr = $data['from_addr'];
|
||||
$toAddr = $data['to_addr'];
|
||||
$amount = $data['amount'];
|
||||
$asset = $data['asset'];
|
||||
$withdraw = Db::name('user_withdraw')->where('order_no',$uuid)->where('status','AGREE')->find();
|
||||
if($withdraw){
|
||||
Db::startTrans();
|
||||
if($withdraw['from_address'] != $fromAddr) return false;
|
||||
if($withdraw['to_address'] != $toAddr) return false;
|
||||
if($withdraw['amount'] != $amount) return false;
|
||||
if($withdraw['type'] != $asset) return false;
|
||||
|
||||
// 更改状态
|
||||
$res = Db::name('user_withdraw')->where('id',$withdraw['id'])->update([
|
||||
'status' => 'SUCCESS',
|
||||
'update_time' => time(),
|
||||
]);
|
||||
if(!$res) return;
|
||||
|
||||
Db::commit();
|
||||
|
||||
return json_encode(['code' => 0]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验签名
|
||||
* @param $data
|
||||
* @return bool
|
||||
*/
|
||||
private function verifySign($data)
|
||||
{
|
||||
$payChannelConfig = Db::name('pay_channel')->where('key','USDT')->value('value');
|
||||
$config = json_decode($payChannelConfig,true);
|
||||
|
||||
$key = urlencode($data['key']);
|
||||
$timestamp = urlencode($data['timestamp']);
|
||||
$signData = "key={$key}";
|
||||
$signData .= "&merch_addr={$config['merch_addr']}";
|
||||
$signData .= "&merch_type={$config['merch_type']}";
|
||||
$signData .= "×tamp={$timestamp}";
|
||||
$signData .= "&access_token={$config['access_token']}";
|
||||
$sign = sha1($signData);
|
||||
return $sign == $data['sign'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录日志
|
||||
* @param $type
|
||||
* @param $json
|
||||
* @return mixed
|
||||
*/
|
||||
private function addLog($type,$json)
|
||||
{
|
||||
$id = Db::name('pay_callback_log')->insertGetId([
|
||||
'pay_channel' => $type,
|
||||
'type' => $type,
|
||||
'json' => $json,
|
||||
'create_time' => date('Y-m-d H:i:s'),
|
||||
]);
|
||||
return $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新唯一识别值
|
||||
* @param $id
|
||||
* @param $uniqueNo
|
||||
* @return mixed
|
||||
*/
|
||||
private function setUniqueNo($id,$uniqueNo)
|
||||
{
|
||||
$res = Db::name('pay_callback_log')->where('id',$id)->update([
|
||||
'unique_no' => $uniqueNo,
|
||||
]);
|
||||
return $res;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
namespace app\onlinechip\controller;
|
||||
use \think\Controller;
|
||||
|
||||
class Error Extends Controller{
|
||||
public function index(){
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
namespace app\onlinechip\controller;
|
||||
use \think\Controller;
|
||||
use \think\Session;
|
||||
use \think\Request;
|
||||
use \think\Db;
|
||||
use think\Lang;
|
||||
|
||||
class Index Extends Controller{
|
||||
public function index(){
|
||||
// 获取语言包
|
||||
$lang = Lang::get();
|
||||
$lang = json_encode($lang);
|
||||
// 渲染参数和模板
|
||||
$this->assign('lang',$lang);
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,910 @@
|
||||
<?php
|
||||
namespace app\onlinechip\controller;
|
||||
|
||||
use think\Cache;
|
||||
use \think\Controller;
|
||||
use \think\Request;
|
||||
use \think\Db;
|
||||
use \think\Lang;
|
||||
use \think\Session;
|
||||
use \think\Log;
|
||||
use \think\Config;
|
||||
use Waybill\WaybillDice;
|
||||
use Waybill\WaybillRoulette;
|
||||
use Waybill\WaybillToning;
|
||||
|
||||
class Managerapi extends Controller{
|
||||
//登录
|
||||
public function login(){
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header("Access-Control-Allow-Headers: token, Origin, X-Requested-With, Content-Type, Accept, Authorization");
|
||||
header('Access-Control-Allow-Methods: POST,GET,PUT,DELETE');
|
||||
if(Request::instance()->isPost()){
|
||||
$json_arr = decrypt_data(Request::instance()->post());
|
||||
if($json_arr){
|
||||
$username = trim($json_arr['username']);
|
||||
$password = trim($json_arr['password']);
|
||||
if(empty($username) || empty($password)){
|
||||
return json(['Success' => 0, 'Msg' => '请填写账号密码']);
|
||||
}
|
||||
$find = Db::name('manager')->where(array('username' => $username, 'status' => 1))->find();
|
||||
if($find){
|
||||
if(think_ucenter_md5($password, UC_AUTH_KEY) === $find['password'] && $find['password']){
|
||||
$user_log = array();
|
||||
$user_log['user_id'] = $find['id'];
|
||||
$user_log['username'] = $find['username'];
|
||||
$user_log['nickname'] = $find['nickname'];
|
||||
$user_log['ip'] = getIP();
|
||||
$user_log['client'] = 'PC或H5';
|
||||
$user_log['create_time'] = time();
|
||||
$user_log['remark'] = '登录';
|
||||
Db::name('manager_log')->insert($user_log);
|
||||
$online_token = $this->create_online_token($find);
|
||||
$find['online_token'] = $online_token;
|
||||
$find['login_token'] = $online_token;
|
||||
$update = array();
|
||||
$update['login_token'] = $online_token;
|
||||
$update['last_login_time'] = time();
|
||||
$update['last_login_ip'] = getIP();
|
||||
$api_token = create_api_token($find['username'],$find['nickname']);
|
||||
$update['api_token'] = $api_token;
|
||||
Db::name('manager')->where(array('id' => $find['id']))->limit(1)->update($update);
|
||||
$find['api_token'] = $api_token;
|
||||
//存入session
|
||||
Db::name('manager_session')->where(array('last_time' => array('<', time() - Config::get('session_life_time'))))->delete();
|
||||
$DBSession = Db::name('manager_session')->where(array('session_id' => $api_token))->find();
|
||||
if($DBSession){
|
||||
Db::name('manager_session')->where(array('session_id' => $api_token))->update(array('last_time' => time(), 'user_id' => $find['id']));
|
||||
}else{
|
||||
Db::name('manager_session')->where(array('user_id' => $find['id']))->delete();
|
||||
Db::name('manager_session')->insert(array('session_id' =>$api_token, 'last_time' => time(), 'user_id' => $find['id']));
|
||||
}
|
||||
unset($find['password']);
|
||||
unset($find['encrypt']);
|
||||
|
||||
$data = encrypt_data($find);
|
||||
return json(['Success' => 1, 'Msg' => '登录成功', 'Data' => $data]);
|
||||
}else{
|
||||
return json(['Success' => 0, 'Msg' => '账号或者密码错误']);
|
||||
}
|
||||
}else{
|
||||
return json(['Success' => 0, 'Msg' => '账号或者密码错误']);
|
||||
}
|
||||
}else{
|
||||
return json(['Success' => 0, 'Msg' => '登录出错']);
|
||||
}
|
||||
}else{
|
||||
return json(['Success' => 0, 'Msg' => '登录出错']);
|
||||
}
|
||||
}
|
||||
|
||||
public function get_user_info(){
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header("Access-Control-Allow-Headers: token, Origin, X-Requested-With, Content-Type, Accept, Authorization");
|
||||
header('Access-Control-Allow-Methods: POST,GET,PUT,DELETE');
|
||||
if(Request::instance()->isPost()){
|
||||
$json_arr = decrypt_data(Request::instance()->post());
|
||||
if($json_arr){
|
||||
$api_token = trim($json_arr['api_token']);
|
||||
$user_id = Db::name('manager_session')->where(array('session_id' =>$api_token))->value('user_id');
|
||||
$find = Db::name('manager')->where(array('id' => $user_id,'status' => 1))->find();
|
||||
if($find){
|
||||
$online_token = $this->create_online_token($find);
|
||||
$find['online_token'] = $online_token;
|
||||
$find['login_token'] = $online_token;
|
||||
$find['api_token'] = $api_token;
|
||||
|
||||
unset($find['password']);
|
||||
unset($find['encrypt']);
|
||||
$data = encrypt_data($find);
|
||||
return json(['Success' => 1, 'Msg' => '操作成功', 'Data' => $data]);
|
||||
}else{
|
||||
return json(['Success' => 0, 'Msg' => '暂无数据']);
|
||||
}
|
||||
}else{
|
||||
return json(['Success' => 0, 'Msg' => '操作错误']);
|
||||
}
|
||||
}else{
|
||||
return json(['Success' => 0, 'Msg' => '操作错误']);
|
||||
}
|
||||
}
|
||||
//修改密码
|
||||
public function update_password(){
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header("Access-Control-Allow-Headers: token, Origin, X-Requested-With, Content-Type, Accept, Authorization");
|
||||
header('Access-Control-Allow-Methods: POST,GET,PUT,DELETE');
|
||||
if(Request::instance()->isPost()){
|
||||
$json_arr = decrypt_data(Request::instance()->post());
|
||||
if($json_arr){
|
||||
$user_id = intval($json_arr['user_id']);
|
||||
$password_now = trim($json_arr['password_now']);
|
||||
$password_new = trim($json_arr['password_new']);
|
||||
$password_reply = trim($json_arr['password_reply']);
|
||||
$api_token = trim($json_arr['api_token']);
|
||||
if($user_id > 0){
|
||||
$find = Db::name('manager')->where(array('id' => $user_id))->find();
|
||||
if($find && $find['api_token'] == $api_token){
|
||||
if(empty($password_now) || empty($password_new) || empty($password_reply) || strlen($password_new) < 6){
|
||||
return json(['Success' => 0, 'Msg' => '请填写当前密码以及新密码,新密码不能小于6个字符']);
|
||||
}
|
||||
if($password_new != $password_reply){
|
||||
return json(['Success' => 0, 'Msg' => '两次密码不一致']);
|
||||
}
|
||||
if(think_ucenter_md5($password_now, UC_AUTH_KEY) == $find['password'] && $find['password']){
|
||||
$newPass = think_ucenter_md5($password_new, UC_AUTH_KEY);
|
||||
$res = Db::name('manager')->where(array('id' => $user_id))->limit(1)->update(array('password' => $newPass));
|
||||
if($res){
|
||||
return json(['Success' => 1, 'Msg' => '修改密码成功']);
|
||||
}else{
|
||||
return json(['Success' => 0, 'Msg' => '修改密码失败']);
|
||||
}
|
||||
}else{
|
||||
return json(['Success' => 0, 'Msg' => '旧密码输入错误']);
|
||||
}
|
||||
}else{
|
||||
return json(['Success' => 0, 'Msg' => '修改密码失败']);
|
||||
}
|
||||
}else{
|
||||
return json(['Success' => 0, 'Msg' => '修改密码失败']);
|
||||
}
|
||||
}else{
|
||||
return json(['Success' => 0, 'Msg' => '修改密码失败']);
|
||||
}
|
||||
}else{
|
||||
return json(['Success' => 0, 'Msg' => '修改密码失败']);
|
||||
}
|
||||
}
|
||||
//获取玩家列表
|
||||
public function get_player_list(){
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header("Access-Control-Allow-Headers: token, Origin, X-Requested-With, Content-Type, Accept, Authorization");
|
||||
header('Access-Control-Allow-Methods: POST,GET,PUT,DELETE');
|
||||
if(Request::instance()->isPost()){
|
||||
$json_arr = decrypt_data(Request::instance()->post());
|
||||
if($json_arr){
|
||||
$user_id = intval($json_arr['user_id']);
|
||||
$api_token = trim($json_arr['api_token']);
|
||||
$page = intval($json_arr['page']);
|
||||
$find = Db::name('manager')->where(array('id' => $user_id,'status' => 1))->find();
|
||||
$tableInfo = Db::name('table')->field(['id,table_name'])->select();
|
||||
$tableInfo = array_column($tableInfo,'table_name','id');
|
||||
if($find && $find['api_token'] == $api_token && $page > 0){
|
||||
$page_list = 15;
|
||||
if($page > 1){
|
||||
$limie_start = ($page - 1) * $page_list;
|
||||
}else{
|
||||
$limie_start = 0;
|
||||
}
|
||||
$where = [];
|
||||
$where['manager_id'] = $find['id'];
|
||||
$where['is_delete'] = 0;
|
||||
$where['status'] = 1;
|
||||
$where['agent'] = 0;
|
||||
$where['bet_type'] = 2;
|
||||
$findPlayer = Db::name('user')->where($where)->order('last_login_time DESC')->limit($limie_start,$page_list)->select();
|
||||
$player_num = Db::name('user')->where($where)->count();
|
||||
$page_num = ceil($player_num/$page_list);
|
||||
|
||||
$playerData = [];
|
||||
foreach ($findPlayer as $val){
|
||||
$data = [];
|
||||
$data['id'] = $val['id'];
|
||||
$data['username'] = $val['username'];
|
||||
$data['nickname'] = $val['nickname'];
|
||||
$data['last_login_time'] = $val['last_login_time'] ? date('Y-m-d H:i:s',$val['last_login_time']) : '-';
|
||||
$data['is_online'] = 0;
|
||||
$data['server_status'] = 0;
|
||||
$data['table_id'] = 0;
|
||||
$data['table_name'] = '';
|
||||
$data['bet_amount'] = 0;
|
||||
if($val['api_token']){
|
||||
$sessionInfo = Db::name('session')->where(['session_id' => $val['api_token'],'user_id' => $val['id']])->find();
|
||||
if((time() - $sessionInfo['last_time']) <= Config::get('session_life_time')){
|
||||
$data['server_status'] = $sessionInfo['server_status'];
|
||||
$data['is_online'] = 1;
|
||||
if($sessionInfo['table_id']){
|
||||
$data['table_id'] = $sessionInfo['table_id'];
|
||||
$data['table_name'] = $tableInfo[$sessionInfo['table_id']] ? $tableInfo[$sessionInfo['table_id']] : '';
|
||||
$numberTabInfo = Db::name('number_tab')->field(['id'])->where('table_id',$sessionInfo['table_id'])->order('id DESC')->limit(1)->find();
|
||||
if($numberTabInfo['id']){
|
||||
$betInfo = Db::name('bet')->where(['table_id' => $sessionInfo['table_id'],'number_tab_id' => $numberTabInfo['id'],'user_id' => $val['id']])->field(['amount'])->find();
|
||||
$data['bet_amount'] = (int)$betInfo['amount'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$playerData[] = $data;
|
||||
}
|
||||
$returnData['player_data'] = $playerData;
|
||||
$returnData['player_num'] = $player_num;
|
||||
$returnData['page_num'] = $page_num;
|
||||
$returnData = encrypt_data($returnData);
|
||||
return json(array('Success' => 1, 'Data' => $returnData));
|
||||
|
||||
}else{
|
||||
return json(['Success' => 0, 'Msg' => '获取失败']);
|
||||
}
|
||||
}else{
|
||||
return json(['Success' => 0, 'Msg' => '获取失败']);
|
||||
}
|
||||
}else{
|
||||
return json(['Success' => 0, 'Msg' => '获取失败']);
|
||||
}
|
||||
}
|
||||
public function online_players() {
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header("Access-Control-Allow-Headers: token, Origin, X-Requested-With, Content-Type, Accept, Authorization");
|
||||
header('Access-Control-Allow-Methods: POST,GET,PUT,DELETE');
|
||||
|
||||
if(Request::instance()->post()){
|
||||
$json_arr = decrypt_data(Request::instance()->post());
|
||||
if ($json_arr) {
|
||||
$user_id = intval($json_arr['user_id']);
|
||||
$api_token = trim($json_arr['api_token']);
|
||||
$find = Db::name('manager')->where(array('id' => $user_id,'status' => 1, 'api_token' => $api_token))->find();
|
||||
$user_online = array();
|
||||
if ($find) {
|
||||
$session_user = Db::name('session')->select();
|
||||
foreach($session_user as $v){
|
||||
$time = time() - Config::get('session_life_time');
|
||||
if($v['last_time'] < $time){
|
||||
//30分钟内没操作,移除在线在在线玩家的列表
|
||||
Db::name('session')->where('user_id',$v['user_id'])->delete();
|
||||
}else{
|
||||
//30分钟内有操作的玩家,并且是该代理下面的直属玩家
|
||||
$user = Db::name('user')->where(['id'=>$v['user_id'], 'manager_id'=>$user_id])->find();
|
||||
if($user){
|
||||
$user_online[] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return json(array('Success' => 1, 'Data' => encrypt_data($user_online)));
|
||||
|
||||
}
|
||||
return json(['Success' => 0, 'Msg' => '获取失败']);
|
||||
}else{
|
||||
return json(['Success' => 0, 'Msg' => '获取失败']);
|
||||
}
|
||||
}
|
||||
|
||||
//开始/停止服务
|
||||
public function operate_server(){
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header("Access-Control-Allow-Headers: token, Origin, X-Requested-With, Content-Type, Accept, Authorization");
|
||||
header('Access-Control-Allow-Methods: POST,GET,PUT,DELETE');
|
||||
if(Request::instance()->isPost()){
|
||||
$json_arr = decrypt_data(Request::instance()->post());
|
||||
if($json_arr){
|
||||
$user_id = intval($json_arr['user_id']);
|
||||
$player_id = intval($json_arr['player_id']);
|
||||
$operate_type = intval($json_arr['operate_type']);//1开启 0 关闭
|
||||
$api_token = trim($json_arr['api_token']);
|
||||
if($user_id && $player_id){
|
||||
$find = Db::name('manager')->where(array('id' => $user_id))->find();
|
||||
if($find && $find['api_token'] == $api_token){
|
||||
$findUserSession = Db::name('session')->where(array('user_id' => $player_id))->find();
|
||||
if($findUserSession && time() - $findUserSession['last_time'] <= Config::get('session_life_time')){
|
||||
$updateData = [];
|
||||
$updateData['server_status'] = $operate_type;
|
||||
$res = Db::name('session')->where('user_id',$player_id)->update($updateData);
|
||||
if($res){
|
||||
return json(['Success' => 1, 'Msg' => '操作成功']);
|
||||
}else{
|
||||
return json(['Success' => 0, 'Msg' => '操作失败']);
|
||||
}
|
||||
}else{
|
||||
return json(['Success' => 0, 'Msg' => '操作失败']);
|
||||
}
|
||||
}else{
|
||||
return json(['Success' => 0, 'Msg' => '操作失败']);
|
||||
}
|
||||
}else{
|
||||
return json(['Success' => 0, 'Msg' => '操作失败']);
|
||||
}
|
||||
}else{
|
||||
return json(['Success' => 0, 'Msg' => '操作失败']);
|
||||
}
|
||||
|
||||
}else{
|
||||
return json(['Success' => 0, 'Msg' => '操作失败']);
|
||||
}
|
||||
}
|
||||
|
||||
public function all_table(){
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header("Access-Control-Allow-Headers: token, Origin, X-Requested-With, Content-Type, Accept, Authorization");
|
||||
header('Access-Control-Allow-Methods: POST,GET,PUT,DELETE');
|
||||
if(Request::instance()->isPost()){
|
||||
$json_arr = decrypt_data(Request::instance()->post());
|
||||
if($json_arr){
|
||||
$user_id = intval($json_arr['user_id']);
|
||||
$api_token = trim($json_arr['api_token']);
|
||||
$user = Db::name('manager')->where(array('id' => $user_id))->find();
|
||||
|
||||
if($user && $user['api_token'] == $api_token){
|
||||
$tableWhere = [];
|
||||
$tableWhere['status'] = 1;
|
||||
$tableWhere['table_type'] = 0;
|
||||
$tableWhere['bet_type'] = 2;
|
||||
$tables = Db::name('table')->where($tableWhere)->whereIn('game_id',[1,2])->order('sort DESC')->select();
|
||||
|
||||
$bootTabTable = 'boot';
|
||||
$numberTabTable = 'number_tab';
|
||||
$betTable = 'bet';
|
||||
|
||||
foreach($tables AS $key => $value){
|
||||
$tableData = [];
|
||||
$tableData['id'] = $value['id'];
|
||||
$tableData['table_name'] = $value['table_name'];
|
||||
$tableData['game_id'] = $value['game_id'];
|
||||
$tableData['table_num'] = $value['table_num'];
|
||||
$tableData['game_name'] = $value['game_name'];
|
||||
$tableData['limit_money'] = $value['limit_money'];
|
||||
$tableData['limit_money_tie'] = $value['limit_money_tie'];
|
||||
if($value['game_id'] == 1){
|
||||
$tableData['limit_money_pair'] = $value['limit_money_pair'];
|
||||
}
|
||||
$tableData['in_checkout'] = $value['in_checkout'];
|
||||
|
||||
$tableData['bet_amount_msg']['banker_amount'] = 0;
|
||||
$tableData['bet_amount_msg']['player_amount'] = 0;
|
||||
$tableData['bet_amount_msg']['tie_amount'] = 0;
|
||||
if($value['game_id'] == 1){
|
||||
$tableData['bet_amount_msg']['banker_pair_amount'] = 0;
|
||||
$tableData['bet_amount_msg']['player_pair_amount'] = 0;
|
||||
}
|
||||
|
||||
$tableData['status'] = $value['status'];
|
||||
$tableData['is_scavenging'] = $value['is_scavenging'];
|
||||
$tableData['wait_time'] = $value['wait_time'];
|
||||
$tableData['rob_time'] = $value['rob_time'];
|
||||
$tableData['media_far_rtmp'] = $value['media_far_rtmp'];
|
||||
$tableData['media_far_flv'] = $value['media_far_flv'];
|
||||
$tableData['media_far_ws'] = $value['media_far_ws'];
|
||||
$tableData['media_near_rtmp'] = $value['media_near_rtmp'];
|
||||
$tableData['media_near_flv'] = $value['media_near_flv'];
|
||||
$tableData['media_near_ws'] = $value['media_near_ws'];
|
||||
$tableData['bet_type'] = $value['bet_type'];
|
||||
$tableData['is_rob'] = $value['is_rob'];
|
||||
$tableData['limit_banker_amount'] = $value['limit_banker_amount'];
|
||||
$tableData['table_type'] = $value['table_type'];
|
||||
$tableData['is_localhost_control'] = $value['is_localhost_control'];
|
||||
$tableData['phone'] = $value['phone'];
|
||||
$tableData['interval_time'] = $value['interval_time'];
|
||||
$tableData['card_first_type'] = $value['card_first_type'];
|
||||
$tableData['spec_type'] = $value['spec_type'];
|
||||
$tableData['scanner_type'] = $value['scanner_type'];
|
||||
$tableData['seat_num'] = $value['seat_num'];
|
||||
|
||||
|
||||
$boot = Db::name($bootTabTable)->where('table_id',$value['id'])->order('id DESC')->find();
|
||||
if($boot){
|
||||
$tableData['boot_num'] = $boot['boot_num'];
|
||||
$tableData['boot_id'] = $boot['id'];
|
||||
$cur_number_tab = Db::name($numberTabTable)->where(array('table_id' => $value['id'], 'boot_id' => $boot['id']))->order('id DESC')->find();
|
||||
$tableData['number_tab_number'] = is_array($cur_number_tab) ? $cur_number_tab['number'] : 1;
|
||||
$tableData['number_tab_id'] = is_array($cur_number_tab) ? $cur_number_tab['id'] : 1;
|
||||
$tableData['bet_status'] = $cur_number_tab['bet_status'];
|
||||
$seat_arr = json_decode($cur_number_tab['seat_json'],true);
|
||||
//自动台返回牌型
|
||||
if($value['is_scavenging'] == 1 && $cur_number_tab['bet_status'] == 2){
|
||||
$card_info = getRedisCardByPosition($cur_number_tab['id']);
|
||||
if($card_info){
|
||||
$tableData['card_info']['banker_1'] = $card_info['banker_1'];
|
||||
if($value['game_id'] == 1){
|
||||
$tableData['card_info']['banker_2'] = $card_info['banker_2'];
|
||||
$tableData['card_info']['banker_3'] = $card_info['banker_3'];
|
||||
}
|
||||
$tableData['card_info']['player_1'] = $card_info['player_1'];
|
||||
if($value['game_id'] == 1){
|
||||
$tableData['card_info']['player_2'] = $card_info['player_2'];
|
||||
$tableData['card_info']['player_3'] = $card_info['player_3'];
|
||||
}
|
||||
}else{
|
||||
$tableData['card_info']['banker_1'] = 0;
|
||||
if($value['game_id'] == 1){
|
||||
$tableData['card_info']['banker_2'] = 0;
|
||||
$tableData['card_info']['banker_3'] = 0;
|
||||
}
|
||||
$tableData['card_info']['player_1'] = 0;
|
||||
if($value['game_id'] == 1){
|
||||
$tableData['card_info']['player_2'] = 0;
|
||||
$tableData['card_info']['player_3'] = 0;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$tableData['card_info']['banker_1'] = 0;
|
||||
if($value['game_id'] == 1){
|
||||
$tableData['card_info']['banker_2'] = 0;
|
||||
$tableData['card_info']['banker_3'] = 0;
|
||||
}
|
||||
$tableData['card_info']['player_1'] = 0;
|
||||
if($value['game_id'] == 1){
|
||||
$tableData['card_info']['player_2'] = 0;
|
||||
$tableData['card_info']['player_3'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$tableData['bet_info'] = [];
|
||||
$sql = "SELECT u.id,u.username,s.last_time,s.server_status FROM cg_user u,cg_session s
|
||||
WHERE u.manager_id = ".$user['id']." AND u.api_token = s.session_id AND s.table_id = ".$value['id'];
|
||||
$res = Db::query($sql);
|
||||
foreach ($res as $val){
|
||||
if((time() - $val['last_time']) > Config::get('session_life_time')){
|
||||
continue;
|
||||
}
|
||||
$userData = [];
|
||||
$userData['user_id'] = $val['id'];
|
||||
$userData['username'] = $val['username'];
|
||||
$userData['server_status'] = $val['server_status'];
|
||||
$userData['bet_amount'] = 0;
|
||||
if(isset($seat_arr[$user_id])){
|
||||
$nowSeatNum = array_search($val['id'],$seat_arr[$user_id]);
|
||||
if($nowSeatNum){
|
||||
$userData['seat_num'] = $nowSeatNum;
|
||||
}else{
|
||||
$userData['seat_num'] = 0;
|
||||
}
|
||||
}else{
|
||||
$userData['seat_num'] = 0;
|
||||
}
|
||||
if($cur_number_tab['bet_status'] == 1 || $cur_number_tab['bet_status'] == 2){
|
||||
$bet = Db::name($betTable)->where(array('table_id' => $value['id'], 'boot_id' => $boot['id'], 'number_tab_id' => $cur_number_tab['id'], 'user_id' => $val['id']))->find();
|
||||
if($bet){
|
||||
$userData['seat_num'] = $bet['seat_num'];
|
||||
$userData['bet_amount'] = (int)$bet['amount'];
|
||||
$userData['banker_amount'] = (int)$bet['banker_amount'];
|
||||
$userData['player_amount'] = (int)$bet['player_amount'];
|
||||
$userData['tie_amount'] = (int)$bet['tie_amount'];
|
||||
if($value['game_id'] == 1){
|
||||
$userData['banker_pair_amount'] = (int)$bet['banker_pair_amount'];
|
||||
$userData['player_pair_amount'] = (int)$bet['player_pair_amount'];
|
||||
}
|
||||
|
||||
$tableData['bet_amount_msg']['banker_amount'] = (int)$tableData['bet_amount_msg']['banker_amount'] + (int)$bet['banker_amount'];
|
||||
$tableData['bet_amount_msg']['player_amount'] = (int)$tableData['bet_amount_msg']['player_amount'] + (int)$bet['player_amount'];
|
||||
$tableData['bet_amount_msg']['tie_amount'] = (int)$tableData['bet_amount_msg']['tie_amount'] + (int)$bet['tie_amount'];
|
||||
if($value['game_id'] == 1){
|
||||
$tableData['bet_amount_msg']['banker_pair_amount'] = (int)$tableData['bet_amount_msg']['banker_pair_amount'] + (int)$bet['banker_pair_amount'];
|
||||
$tableData['bet_amount_msg']['player_pair_amount'] = (int)$tableData['bet_amount_msg']['player_pair_amount'] + (int)$bet['player_pair_amount'];;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$tableData['bet_info'][] = $userData;
|
||||
}
|
||||
}else{
|
||||
$tableData['boot_num'] = 1;
|
||||
$tableData['boot_id'] = 0;
|
||||
$tableData['number_tab_number'] = 1;
|
||||
$tableData['number_tab_id'] = 0;
|
||||
$tableData['bet_status'] = 0;
|
||||
$tableData['bet_info'] = [];
|
||||
$tableData['bet_amount_msg'] = [];
|
||||
$tableData['card_info'] = [];
|
||||
|
||||
}
|
||||
$tables[$key] = $tableData;
|
||||
}
|
||||
$data = encrypt_data($tables);
|
||||
return json(array('Success' => 1, 'Data' => $data));
|
||||
}else{
|
||||
return json(array('Success' => 0, 'Msg' => '获取信息失败'));
|
||||
}
|
||||
}else{
|
||||
return json(array('Success' => 0, 'Msg' => '获取信息失败'));
|
||||
}
|
||||
} else {
|
||||
return json(array('Success' => 0, 'Msg' => '获取信息失败'));
|
||||
}
|
||||
}
|
||||
|
||||
public function single_table(){
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header("Access-Control-Allow-Headers: token, Origin, X-Requested-With, Content-Type, Accept, Authorization");
|
||||
header('Access-Control-Allow-Methods: POST,GET,PUT,DELETE');
|
||||
if(Request::instance()->isPost()){
|
||||
$json_arr = decrypt_data(Request::instance()->post());
|
||||
if($json_arr){
|
||||
$user_id = intval($json_arr['user_id']);
|
||||
$api_token = trim($json_arr['api_token']);
|
||||
$table_id = intval($json_arr['table_id']);
|
||||
$user = Db::name('manager')->where(array('id' => $user_id))->find();
|
||||
|
||||
if($user && $user['api_token'] == $api_token){
|
||||
$tableWhere = [];
|
||||
$tableWhere['status'] = 1;
|
||||
$tableWhere['table_type'] = 0;
|
||||
$tableWhere['bet_type'] = 2;
|
||||
$tableWhere['id'] = $table_id;
|
||||
$tableInfo = Db::name('table')->where($tableWhere)->whereIn('game_id',[1,2])->order('sort DESC')->find();
|
||||
|
||||
if($tableInfo){
|
||||
$bootTabTable = 'boot';
|
||||
$numberTabTable = 'number_tab';
|
||||
$betTable = 'bet';
|
||||
|
||||
$tableData = [];
|
||||
$tableData['id'] = $tableInfo['id'];
|
||||
$tableData['table_name'] = $tableInfo['table_name'];
|
||||
$tableData['game_id'] = $tableInfo['game_id'];
|
||||
$tableData['table_num'] = $tableInfo['table_num'];
|
||||
$tableData['game_name'] = $tableInfo['game_name'];
|
||||
$tableData['limit_money'] = $tableInfo['limit_money'];
|
||||
$tableData['limit_money_tie'] = $tableInfo['limit_money_tie'];
|
||||
if($tableInfo['game_id'] == 1){
|
||||
$tableData['limit_money_pair'] = $tableInfo['limit_money_pair'];
|
||||
}
|
||||
$tableData['in_checkout'] = $tableInfo['in_checkout'];
|
||||
|
||||
$tableData['bet_amount_msg']['banker_amount'] = 0;
|
||||
$tableData['bet_amount_msg']['player_amount'] = 0;
|
||||
$tableData['bet_amount_msg']['tie_amount'] = 0;
|
||||
if($tableInfo['game_id'] == 1){
|
||||
$tableData['bet_amount_msg']['banker_pair_amount'] = 0;
|
||||
$tableData['bet_amount_msg']['player_pair_amount'] = 0;
|
||||
}
|
||||
|
||||
$tableData['status'] = $tableInfo['status'];
|
||||
$tableData['is_scavenging'] = $tableInfo['is_scavenging'];
|
||||
$tableData['wait_time'] = $tableInfo['wait_time'];
|
||||
$tableData['rob_time'] = $tableInfo['rob_time'];
|
||||
$tableData['media_far_rtmp'] = $tableInfo['media_far_rtmp'];
|
||||
$tableData['media_far_flv'] = $tableInfo['media_far_flv'];
|
||||
$tableData['media_far_ws'] = $tableInfo['media_far_ws'];
|
||||
$tableData['media_near_rtmp'] = $tableInfo['media_near_rtmp'];
|
||||
$tableData['media_near_flv'] = $tableInfo['media_near_flv'];
|
||||
$tableData['media_near_ws'] = $tableInfo['media_near_ws'];
|
||||
$tableData['bet_type'] = $tableInfo['bet_type'];
|
||||
$tableData['is_rob'] = $tableInfo['is_rob'];
|
||||
$tableData['limit_banker_amount'] = $tableInfo['limit_banker_amount'];
|
||||
$tableData['table_type'] = $tableInfo['table_type'];
|
||||
$tableData['is_localhost_control'] = $tableInfo['is_localhost_control'];
|
||||
$tableData['phone'] = $tableInfo['phone'];
|
||||
$tableData['interval_time'] = $tableInfo['interval_time'];
|
||||
$tableData['card_first_type'] = $tableInfo['card_first_type'];
|
||||
$tableData['spec_type'] = $tableInfo['spec_type'];
|
||||
$tableData['scanner_type'] = $tableInfo['scanner_type'];
|
||||
$tableData['seat_num'] = $tableInfo['seat_num'];
|
||||
|
||||
|
||||
$boot = Db::name($bootTabTable)->where('table_id',$tableInfo['id'])->order('id DESC')->find();
|
||||
if($boot){
|
||||
$tableData['boot_num'] = $boot['boot_num'];
|
||||
$tableData['boot_id'] = $boot['id'];
|
||||
$cur_number_tab = Db::name($numberTabTable)->where(array('table_id' => $tableInfo['id'], 'boot_id' => $boot['id']))->order('id DESC')->find();
|
||||
$tableData['number_tab_number'] = is_array($cur_number_tab) ? $cur_number_tab['number'] : 1;
|
||||
$tableData['number_tab_id'] = is_array($cur_number_tab) ? $cur_number_tab['id'] : 1;
|
||||
$tableData['bet_status'] = $cur_number_tab['bet_status'];
|
||||
$seat_arr = json_decode($cur_number_tab['seat_json'],true);
|
||||
//自动台返回牌型
|
||||
if($tableInfo['is_scavenging'] == 1 && $cur_number_tab['bet_status'] == 2){
|
||||
$card_info = getRedisCardByPosition($cur_number_tab['id']);
|
||||
if($card_info){
|
||||
$tableData['card_info']['banker_1'] = $card_info['banker_1'];
|
||||
if($tableInfo['game_id'] == 1){
|
||||
$tableData['card_info']['banker_2'] = $card_info['banker_2'];
|
||||
$tableData['card_info']['banker_3'] = $card_info['banker_3'];
|
||||
}
|
||||
$tableData['card_info']['player_1'] = $card_info['player_1'];
|
||||
if($tableInfo['game_id'] == 1){
|
||||
$tableData['card_info']['player_2'] = $card_info['player_2'];
|
||||
$tableData['card_info']['player_3'] = $card_info['player_3'];
|
||||
}
|
||||
}else{
|
||||
$tableData['card_info']['banker_1'] = 0;
|
||||
if($tableInfo['game_id'] == 1){
|
||||
$tableData['card_info']['banker_2'] = 0;
|
||||
$tableData['card_info']['banker_3'] = 0;
|
||||
}
|
||||
$tableData['card_info']['player_1'] = 0;
|
||||
if($tableInfo['game_id'] == 1){
|
||||
$tableData['card_info']['player_2'] = 0;
|
||||
$tableData['card_info']['player_3'] = 0;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$tableData['card_info']['banker_1'] = 0;
|
||||
if($tableInfo['game_id'] == 1){
|
||||
$tableData['card_info']['banker_2'] = 0;
|
||||
$tableData['card_info']['banker_3'] = 0;
|
||||
}
|
||||
$tableData['card_info']['player_1'] = 0;
|
||||
if($tableInfo['game_id'] == 1){
|
||||
$tableData['card_info']['player_2'] = 0;
|
||||
$tableData['card_info']['player_3'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$tableData['bet_info'] = [];
|
||||
$sql = "SELECT u.id,u.username,s.last_time,s.server_status FROM cg_user u,cg_session s
|
||||
WHERE u.manager_id = ".$user['id']." AND u.api_token = s.session_id AND s.table_id = ".$tableInfo['id'];
|
||||
$res = Db::query($sql);
|
||||
foreach ($res as $val){
|
||||
if((time() - $val['last_time']) > Config::get('session_life_time')){
|
||||
continue;
|
||||
}
|
||||
$userData = [];
|
||||
$userData['user_id'] = $val['id'];
|
||||
$userData['username'] = $val['username'];
|
||||
$userData['server_status'] = $val['server_status'];
|
||||
$userData['bet_amount'] = 0;
|
||||
if(isset($seat_arr[$user_id])){
|
||||
$nowSeatNum = array_search($val['id'],$seat_arr[$user_id]);
|
||||
if($nowSeatNum){
|
||||
$userData['seat_num'] = $nowSeatNum;
|
||||
}else{
|
||||
$userData['seat_num'] = 0;
|
||||
}
|
||||
}else{
|
||||
$userData['seat_num'] = 0;
|
||||
}
|
||||
if($cur_number_tab['bet_status'] == 1 || $cur_number_tab['bet_status'] == 2){
|
||||
$bet = Db::name($betTable)->where(array('table_id' => $tableInfo['id'], 'boot_id' => $boot['id'], 'number_tab_id' => $cur_number_tab['id'], 'user_id' => $val['id']))->find();
|
||||
if($bet){
|
||||
$userData['seat_num'] = $bet['seat_num'];
|
||||
$userData['bet_amount'] = $bet['amount'];
|
||||
$userData['banker_amount'] = (int)$bet['banker_amount'];
|
||||
$userData['player_amount'] = (int)$bet['player_amount'];
|
||||
$userData['tie_amount'] = (int)$bet['tie_amount'];
|
||||
if($tableInfo['game_id'] == 1){
|
||||
$userData['banker_pair_amount'] = (int)$bet['banker_pair_amount'];
|
||||
$userData['player_pair_amount'] = (int)$bet['player_pair_amount'];
|
||||
}
|
||||
|
||||
$tableData['bet_amount_msg']['banker_amount'] = (int)$tableData['bet_amount_msg']['banker_amount'] + (int)$bet['banker_amount'];
|
||||
$tableData['bet_amount_msg']['player_amount'] = (int)$tableData['bet_amount_msg']['player_amount'] + $bet['player_amount'];
|
||||
$tableData['bet_amount_msg']['tie_amount'] = (int)$tableData['bet_amount_msg']['tie_amount'] + (int)$bet['tie_amount'];
|
||||
if($tableInfo['game_id'] == 1){
|
||||
$tableData['bet_amount_msg']['banker_pair_amount'] = (int)$tableData['bet_amount_msg']['banker_pair_amount'] + (int)$bet['banker_pair_amount'];
|
||||
$tableData['bet_amount_msg']['player_pair_amount'] = (int)$tableData['bet_amount_msg']['player_pair_amount'] + (int)$bet['player_pair_amount'];;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$tableData['bet_info'][] = $userData;
|
||||
}
|
||||
}else{
|
||||
$tableData['boot_num'] = 1;
|
||||
$tableData['boot_id'] = 0;
|
||||
$tableData['number_tab_number'] = 1;
|
||||
$tableData['number_tab_id'] = 0;
|
||||
$tableData['bet_status'] = 0;
|
||||
$tableData['bet_info'] = [];
|
||||
$tableData['bet_amount_msg'] = [];
|
||||
$tableData['card_info'] = [];
|
||||
|
||||
}
|
||||
$data = encrypt_data($tableData);
|
||||
return json(array('Success' => 1, 'Data' => $data));
|
||||
}else{
|
||||
return json(array('Success' => 0, 'Msg' => '获取信息失败'));
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
return json(array('Success' => 0, 'Msg' => '获取信息失败'));
|
||||
}
|
||||
}else{
|
||||
return json(array('Success' => 0, 'Msg' => '获取信息失败'));
|
||||
}
|
||||
} else {
|
||||
return json(array('Success' => 0, 'Msg' => '获取信息失败'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//游戏记录
|
||||
public function get_user_bets(){
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header("Access-Control-Allow-Headers: token, Origin, X-Requested-With, Content-Type, Accept, Authorization");
|
||||
header('Access-Control-Allow-Methods: POST,GET,PUT,DELETE');
|
||||
if(Request::instance()->isPost()){
|
||||
$json_arr = decrypt_data(Request::instance()->post());
|
||||
|
||||
if($json_arr){
|
||||
// 语言包
|
||||
$langList = ['tw' => 'zh-tw.php','en' => 'en-us.php'];
|
||||
$langType = empty($json_arr['language']) ? 'cn' : $json_arr['language'];
|
||||
$langFile = empty($langList[$langType]) ? 'en-us.php' : $langList[$langType];
|
||||
$langFile = ROOT_PATH.'thinkphp/lang/'.$langFile;
|
||||
Lang::load($langFile);
|
||||
$lang = Lang::get();
|
||||
|
||||
$user_id = intval($json_arr['user_id']);
|
||||
$api_token = trim($json_arr['api_token']);
|
||||
|
||||
$game_id = empty($json_arr['game_id']) ? 0 : intval($json_arr['game_id']);
|
||||
$table_id = empty($json_arr['table_id']) ? 0 : intval($json_arr['table_id']);
|
||||
$username = empty($json_arr['username']) ? '' : trim($json_arr['username']);
|
||||
$page = intval($json_arr['page']);
|
||||
$user = Db::name('manager')->where(array('id' => $user_id))->find();
|
||||
|
||||
if($user && $user['api_token'] == $api_token && $page > 0){
|
||||
|
||||
$betWhere = array();
|
||||
$betWhere['manager_id'] = $user_id;
|
||||
if($game_id){
|
||||
$betWhere['game_id'] = $game_id;
|
||||
}
|
||||
if($table_id){
|
||||
$betWhere['table_id'] = $table_id;
|
||||
}
|
||||
if($username){
|
||||
$betWhere['username'] = $username;
|
||||
}
|
||||
$betWhere['status'] = array('>',0);
|
||||
$page_list = 15;
|
||||
if($page > 1){
|
||||
$limie_start = ($page - 1) * $page_list;
|
||||
}else{
|
||||
$limie_start = 0;
|
||||
}
|
||||
$bet = Db::name('bet')->where($betWhere)->whereIn('game_id',[1,2])->order('id desc')->limit($limie_start,$page_list)->select();
|
||||
$bet_num = Db::name('bet')->where($betWhere)->whereIn('game_id',[1,2])->order('id desc')->count();
|
||||
|
||||
$page_num = ceil($bet_num/$page_list);
|
||||
//组装注单信息
|
||||
$newBet = array();
|
||||
|
||||
$user_bets = array();
|
||||
foreach ($bet as $k => $v){
|
||||
$data = array();
|
||||
$v['create_time'] = date('Y-m-d H:i:s',$v['create_time']);
|
||||
$v['game_num'] = $v['game_id'].$v['boot_num'].$v['number'];
|
||||
|
||||
if($v['game_id'] == 1){
|
||||
$number_info = Db::name('number_tab')->where('id',$v['number_tab_id'])->find();
|
||||
if($number_info['bet_status'] == 3){
|
||||
if($number_info['result'] == 1){
|
||||
$result = $lang['banker'];
|
||||
}elseif($number_info['result'] == 2){
|
||||
$result = $lang['player'];
|
||||
}elseif($number_info['result'] == 3){
|
||||
$result = $lang['tie'];
|
||||
}else{
|
||||
$result = '-';
|
||||
}
|
||||
if($number_info['pair'] == 1){
|
||||
$pair = ','.$lang['banker_pair'];
|
||||
}elseif($number_info['pair'] == 2){
|
||||
$pair = ','.$lang['player_pair'];
|
||||
}elseif($number_info['pair'] == 3){
|
||||
$pair = ','.$lang['both_pair'];
|
||||
}else{
|
||||
$pair = '';
|
||||
}
|
||||
if($number_info['luck_six'] > 1){
|
||||
$luck_six = ','.$lang['luck_6'];
|
||||
}else{
|
||||
$luck_six = '';
|
||||
}
|
||||
if($number_info['big_small'] == 1){
|
||||
$big_small = ','.$lang['big'];
|
||||
}elseif($number_info['big_small'] == 2){
|
||||
$big_small = ','.$lang['small'];
|
||||
}else{
|
||||
$big_small = '';
|
||||
}
|
||||
$v['card_result'] = $result.$pair.$luck_six.$big_small;
|
||||
}else{
|
||||
$v['card_result'] = '-';
|
||||
}
|
||||
if($v['status'] == 2){
|
||||
$v['card_result'] = $lang['void'];
|
||||
}
|
||||
$data['game_num'] = $v['game_num'];
|
||||
$data['table_name'] = $v['table_name'].'('.$v['boot_num'].'/'.$v['number'].')';
|
||||
$data['card_result'] = $v['card_result'];
|
||||
$data['user_bet'] = '';
|
||||
if($v['banker_amount'] > 0){
|
||||
$data['user_bet'] = $data['user_bet'].$lang['banker'].'('.$v['banker_amount'].')';
|
||||
}
|
||||
if($v['player_amount'] > 0){
|
||||
$data['user_bet'] = $data['user_bet'].$lang['player'].'('.$v['player_amount'].')';
|
||||
}
|
||||
if($v['tie_amount'] > 0){
|
||||
$data['user_bet'] = $data['user_bet'].$lang['tie'].'('.$v['tie_amount'].')';
|
||||
}
|
||||
if($v['banker_pair_amount'] > 0){
|
||||
$data['user_bet'] = $data['user_bet'].$lang['banker_pair'].'('.$v['banker_pair_amount'].')';
|
||||
}
|
||||
if($v['player_pair_amount'] > 0){
|
||||
$data['user_bet'] = $data['user_bet'].$lang['player_pair'].'('.$v['player_pair_amount'].')';
|
||||
}
|
||||
if($v['luck_six_amount'] > 0){
|
||||
$data['user_bet'] = $data['user_bet'].$lang['luck_6'].'('.$v['luck_six_amount'].')';
|
||||
}
|
||||
if($v['big_amount'] > 0){
|
||||
$data['user_bet'] = $data['user_bet'].$lang['big'].'('.$v['big_amount'].')';
|
||||
}
|
||||
if($v['small_amount'] > 0){
|
||||
$data['user_bet'] = $data['user_bet'].$lang['small'].'('.$v['small_amount'].')';
|
||||
}
|
||||
if($v['baccarat_type'] == 1){
|
||||
$data['user_bet'] = $data['user_bet'].'('.$lang['free_commission'].')';
|
||||
}else{
|
||||
$data['user_bet'] = $data['user_bet'].'('.$lang['commission'].')';
|
||||
}
|
||||
|
||||
$data['create_time'] = $v['create_time'];
|
||||
$data['money_before_bet'] = $v['money_before_bet'];
|
||||
$data['amount'] = $v['amount'];
|
||||
$data['win_total'] = $v['win_total'];
|
||||
$data['seat_num'] = $v['seat_num'];
|
||||
$data['user_id'] = $v['user_id'];
|
||||
$data['username'] = $v['username'];
|
||||
$data['nickname'] = $v['nickname'];
|
||||
$data['manager_id'] = $user['id'];
|
||||
$data['manager_username'] = $user['username'];
|
||||
$data['manager_nickname'] = $user['nickname'];
|
||||
$newBet[] = $data;
|
||||
}
|
||||
if($v['game_id'] == 2){
|
||||
$number_info = Db::name('number_tab')->where('id',$v['number_tab_id'])->find();
|
||||
if($number_info['bet_status'] == 3){
|
||||
if($number_info['result'] == 1){
|
||||
$result = $lang['dragon'];
|
||||
}elseif($number_info['result'] == 2){
|
||||
$result = $lang['tiger'];
|
||||
}elseif($number_info['result'] == 3){
|
||||
$result = $lang['tie'];
|
||||
}else{
|
||||
$result = '-';
|
||||
}
|
||||
$v['card_result'] = $result;
|
||||
}else{
|
||||
$v['card_result'] = '-';
|
||||
}
|
||||
if($v['status'] == 2){
|
||||
$v['card_result'] = $lang['void'];
|
||||
}
|
||||
$data['game_num'] = $v['game_num'];
|
||||
$data['table_name'] = $v['table_name'].'('.$v['boot_num'].'/'.$v['number'].')';
|
||||
$data['card_result'] = $v['card_result'];
|
||||
$data['user_bet'] = '';
|
||||
if($v['banker_amount'] > 0){
|
||||
$data['user_bet'] = $data['user_bet'].$lang['dragon'].'('.$v['banker_amount'].')';
|
||||
}
|
||||
if($v['player_amount'] > 0){
|
||||
$data['user_bet'] = $data['user_bet'].$lang['tiger'].'('.$v['player_amount'].')';
|
||||
}
|
||||
if($v['tie_amount'] > 0){
|
||||
$data['user_bet'] = $data['user_bet'].$lang['tie'].'('.$v['tie_amount'].')';
|
||||
}
|
||||
$data['create_time'] = $v['create_time'];
|
||||
$data['money_before_bet'] = $v['money_before_bet'];
|
||||
$data['amount'] = $v['amount'];
|
||||
$data['win_total'] = $v['win_total'];
|
||||
$data['seat_num'] = $v['seat_num'];
|
||||
$data['user_id'] = $v['user_id'];
|
||||
$data['username'] = $v['username'];
|
||||
$data['nickname'] = $v['nickname'];
|
||||
$data['manager_id'] = $user['id'];
|
||||
$data['manager_username'] = $user['username'];
|
||||
$data['manager_nickname'] = $user['nickname'];
|
||||
$newBet[] = $data;
|
||||
}
|
||||
}
|
||||
// 重新赋值
|
||||
$user_bets['bet_info'] = $newBet;
|
||||
$user_bets['bet_num'] = $bet_num;
|
||||
$user_bets['page_num'] = $page_num;
|
||||
$bet = encrypt_data($user_bets);
|
||||
return json(array('Success' => 1, 'Data' => $bet));
|
||||
}else{
|
||||
return json(array('Success' => 0, 'Msg' => '获取信息失败'));
|
||||
}
|
||||
|
||||
}else{
|
||||
return json(array('Success' => 0, 'Msg' => '获取信息失败'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function create_online_token($user){
|
||||
return md5($user['encrypt'].$user['password']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
<?php
|
||||
namespace app\onlinechip\controller;
|
||||
use \think\Controller;
|
||||
use think\Exception;
|
||||
use \think\Session;
|
||||
use \think\Request;
|
||||
use \think\Db;
|
||||
use \think\Log;
|
||||
class Order Extends Controller{
|
||||
use traits\yonghengPay;
|
||||
use traits\oneGoPay;
|
||||
use traits\hipPay;
|
||||
use traits\tingPay;
|
||||
use traits\happyPay;
|
||||
use traits\hengfuPay;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function test_post(){
|
||||
return $this->fetch();
|
||||
}
|
||||
public function index(){
|
||||
$user_id = intval(Request::instance()->get('uid'));
|
||||
$api_token = trim(Request::instance()->get('api_token'));
|
||||
$user = Db::name('user')->where(array('id' => $user_id))->find();
|
||||
$area_list = config('area_list');
|
||||
$pay_list = config('pay_list');
|
||||
if(!isset($area_list[$user['area_id']])){
|
||||
exit('所在地区暂不支持充值');
|
||||
}
|
||||
$pay_method = $area_list[$user['area_id']]['pay'];
|
||||
if($user && $user['api_token'] == $api_token){
|
||||
$this->assign('online_order_fac',$pay_list[$pay_method]['online_order_fac']);
|
||||
$this->assign('payMethod',$pay_list[$pay_method]['type']);
|
||||
$this->assign('client',1);
|
||||
$this->assign('user_info',$user);
|
||||
return $this->fetch();
|
||||
}else{
|
||||
exit('页面错误,请退出再登录!');
|
||||
}
|
||||
}
|
||||
|
||||
public function wappay(){
|
||||
$user_id = intval(Request::instance()->get('uid'));
|
||||
$api_token = trim(Request::instance()->get('api_token'));
|
||||
$user = Db::name('user')->where(array('id' => $user_id))->find();
|
||||
$area_list = config('area_list');
|
||||
$pay_list = config('pay_list');
|
||||
if(!isset($area_list[$user['area_id']])){
|
||||
exit('所在地区暂不支持充值');
|
||||
}
|
||||
$pay_method = $area_list[$user['area_id']]['pay'];
|
||||
if($user && $user['api_token'] == $api_token){
|
||||
$this->assign('online_order_fac',$pay_list[$pay_method]['online_order_fac']);
|
||||
$this->assign('payMethod',$pay_list[$pay_method]['type']);
|
||||
$this->assign('client',2);
|
||||
$this->assign('user_info',$user);
|
||||
return $this->fetch();
|
||||
}else{
|
||||
exit('页面错误,请退出再登录!');
|
||||
}
|
||||
}
|
||||
|
||||
//确认充值
|
||||
public function recharge(){
|
||||
$user_id = intval(Request::instance()->post('user_id'));
|
||||
$recharge_type = intval(Request::instance()->post('recharge_type'));
|
||||
$receivables_id = intval(Request::instance()->post('receivables_id'));
|
||||
if($recharge_type == 1){
|
||||
$recharge_bank = trim(Request::instance()->post('recharge_bank'));
|
||||
$recharge_cardnumber = trim(Request::instance()->post('recharge_cardnumber'));
|
||||
}
|
||||
$recharge_money = trim(Request::instance()->post('recharge_money'));
|
||||
if(!$recharge_money || $recharge_money <= 0){
|
||||
return json(array('Success' => 0, 'Msg' => '充值金额有误'));
|
||||
}
|
||||
$user = Db::name('user')->where(array('id' => $user_id))->find();
|
||||
|
||||
$zdlIdArr = explode(',',$user['agent_parent_id_path']);
|
||||
$area_list = config('area_list');
|
||||
//判断是否金流支线,如果不是的话,不允许充值
|
||||
$isAllow = false;
|
||||
foreach($area_list[$user['area_id']]['limit_agent'] as $allowAgentId){
|
||||
if(in_array($allowAgentId,$zdlIdArr)){
|
||||
$isAllow = true;
|
||||
}
|
||||
}
|
||||
if(!$isAllow){
|
||||
return json(array('status' => 0, 'message' => '该账号暂不支持充值'));
|
||||
}
|
||||
|
||||
|
||||
if($user && $recharge_type > 0 && $receivables_id > 0 && $recharge_money > 0){
|
||||
$add_record = array();
|
||||
$add_record['user_id'] = $user_id;
|
||||
$add_record['username'] = $user['username'];
|
||||
$add_record['record_type'] = 1;
|
||||
$add_record['recharge_type'] = $recharge_type;
|
||||
$add_record['receivables_id'] = $receivables_id;
|
||||
$recharge_info = Db::name('receivables')->where('id',$receivables_id)->find();
|
||||
$add_record['recharge_name'] = $recharge_info['receivables_name'];
|
||||
$add_record['recharge_name'] = $user['username'];
|
||||
if($add_record['recharge_type'] == 1){
|
||||
$add_record['recharge_bank'] = $recharge_bank;
|
||||
$add_record['recharge_cardnumber'] = $recharge_cardnumber;
|
||||
}
|
||||
$add_record['recharge_money'] = $recharge_money;
|
||||
$add_record['create_time'] = time();
|
||||
$add_record['status'] = 0;
|
||||
$is_add_record = Db::name('receivables_record')->insert($add_record);
|
||||
if($is_add_record){
|
||||
$record_info = array();
|
||||
$record_info['msg'] = '充值成功,请联系管理员确认';
|
||||
$record_info['finish_money'] = Db::name('receivables_record')->where('record_type',1)->where('user_id',$user_id)->where('status',1)->sum('recharge_money');
|
||||
$record_info['ongoing_money'] = Db::name('receivables_record')->where('record_type',1)->where('user_id',$user_id)->where('status',0)->sum('recharge_money');
|
||||
$data = $record_info;
|
||||
return json(array('Success' => 1, 'Data' => $data));
|
||||
}else{
|
||||
return json(array('Success' => 0, 'Msg' => '充值失败,请稍后再试'));
|
||||
}
|
||||
}else{
|
||||
return json(array('Success' => 0, 'Msg' => '获取信息失败'));
|
||||
}
|
||||
}
|
||||
|
||||
//确认提现
|
||||
public function withdrawal(){
|
||||
$user_id = intval(Request::instance()->post('user_id'));
|
||||
$recharge_name = trim(Request::instance()->post('recharge_name'));
|
||||
$recharge_bank = trim(Request::instance()->post('recharge_bank'));
|
||||
$recharge_bank_branch = trim(Request::instance()->post('recharge_bank_branch'));
|
||||
$recharge_cardnumber = trim(Request::instance()->post('recharge_cardnumber'));
|
||||
$recharge_money = trim(Request::instance()->post('recharge_money'));
|
||||
if(!$recharge_name){
|
||||
return json(array('Success' => 0, 'Msg' => '持卡人不能为空'));
|
||||
}
|
||||
if(!$recharge_bank){
|
||||
return json(array('Success' => 0, 'Msg' => '提款银行不能为空'));
|
||||
}
|
||||
if(!$recharge_bank_branch){
|
||||
return json(array('Success' => 0, 'Msg' => '提款银行支行不能为空'));
|
||||
}
|
||||
if(!$recharge_cardnumber){
|
||||
return json(array('Success' => 0, 'Msg' => '提款银行卡号不能为空'));
|
||||
}
|
||||
if(!$recharge_money || $recharge_money <= 0){
|
||||
return json(array('Success' => 0, 'Msg' => '提款金额有误'));
|
||||
}
|
||||
$user = Db::name('user')->where(array('id' => $user_id))->find();
|
||||
$zdlIdArr = explode(',',$user['agent_parent_id_path']);
|
||||
$area_list = config('area_list');
|
||||
//判断是否金流支线,如果不是的话,不允许充值
|
||||
$isAllow = false;
|
||||
foreach($area_list[$user['area_id']]['limit_agent'] as $allowAgentId){
|
||||
if(in_array($allowAgentId,$zdlIdArr)){
|
||||
$isAllow = true;
|
||||
}
|
||||
}
|
||||
if(!$isAllow){
|
||||
return json(array('status' => 0, 'message' => '该账号暂不支持提现'));
|
||||
}
|
||||
if($user){
|
||||
$is_banke_info = Db::name('receivables')->where('user_id',$user_id)->where('receivables_bank',$recharge_bank)->where('type',2)->find();
|
||||
if(!$is_banke_info){
|
||||
$add_bank = array();
|
||||
$add_bank['user_id'] = $user_id;
|
||||
$add_bank['receivables_name'] = $recharge_name;
|
||||
$add_bank['receivables_bank'] = $recharge_bank;
|
||||
$add_bank['receivables_bank_branch'] = $recharge_bank_branch;
|
||||
$add_bank['receivables_bank_number'] = $recharge_cardnumber;
|
||||
$add_bank['create_time'] = time();
|
||||
$add_bank['status'] = 1;
|
||||
$add_bank['type'] = 2;
|
||||
Db::name('receivables')->insert($add_bank);
|
||||
}
|
||||
if($user['money'] > $recharge_money){
|
||||
$add_record = array();
|
||||
$add_record['user_id'] = $user_id;
|
||||
$add_record['username'] = $user['username'];
|
||||
$add_record['record_type'] = 2;
|
||||
$add_record['recharge_name'] = $recharge_name;
|
||||
$add_record['recharge_bank'] = $recharge_bank;
|
||||
$add_record['recharge_bank_branch'] = $recharge_bank_branch;
|
||||
$add_record['recharge_cardnumber'] = $recharge_cardnumber;
|
||||
$add_record['recharge_money'] = $recharge_money;
|
||||
$add_record['create_time'] = time();
|
||||
$add_record['status'] = 0;
|
||||
$is_add_record = Db::name('receivables_record')->insert($add_record);
|
||||
if($is_add_record){
|
||||
$record_info = array();
|
||||
$record_info['msg'] = '提现成功,请等待管理员放款';
|
||||
$record_info['newMoney'] = $user['money'] - $recharge_money;
|
||||
Db::name('user')->where(array('id' => $user_id))->limit(1)->update(array('money' => $record_info['newMoney']));
|
||||
$data = $record_info;
|
||||
return json(array('Success' => 1, 'Data' => $data));
|
||||
}else{
|
||||
return json(array('Success' => 0, 'Msg' => '提现失败,请稍后再试'));
|
||||
}
|
||||
}else{
|
||||
return json(array('Success' => 0, 'Msg' => '您的余额不足'));
|
||||
}
|
||||
}else{
|
||||
return json(array('Success' => 0, 'Msg' => '获取信息失败'));
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+4425
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,315 @@
|
||||
<?php
|
||||
namespace app\onlinechip\controller\traits;
|
||||
use think\Db;
|
||||
use think\Log;
|
||||
use think\Request;
|
||||
trait happyPay{
|
||||
|
||||
|
||||
public function happy_online_order(){
|
||||
$user_id = intval(Request::instance()->post('user_id'));
|
||||
$money = intval(Request::instance()->post('price'));
|
||||
$client = intval(Request::instance()->post('client'));
|
||||
$username = trim(Request::instance()->post('username'));
|
||||
$pay_type = intval(Request::instance()->post('pay_type'));
|
||||
$user = Db::name('user')->where(array('id' => $user_id, 'status' => 1, 'is_delete' => 0, 'agent' => 0))->find();
|
||||
$zdlIdArr = explode(',',$user['agent_parent_id_path']);
|
||||
$area_list = config('area_list');
|
||||
//判断是否金流支线,如果不是的话,不允许充值
|
||||
$isAllow = false;
|
||||
foreach($area_list[$user['area_id']]['limit_agent'] as $allowAgentId){
|
||||
if(in_array($allowAgentId,$zdlIdArr)){
|
||||
$isAllow = true;
|
||||
}
|
||||
}
|
||||
if(!$isAllow){
|
||||
return json(array('status' => 0, 'message' => '该账号暂不支持在线充值'));
|
||||
}
|
||||
$zdlId = $zdlIdArr[0];
|
||||
$zdl = Db::name('user')->where(array('id' => $zdlId, 'status' => 1, 'is_delete' => 0, 'agent' => 1))->find();
|
||||
if(!$zdl){
|
||||
return json(array('status' => 0, 'message' => '所属代理账号异常,暂不能充值'));
|
||||
}
|
||||
if($zdl['money'] < $money){
|
||||
return json(array('status' => 0, 'message' => '所属代理余额不足,暂不能充值'));
|
||||
}
|
||||
$pay_list = config('pay_list');
|
||||
if($user && $user_id > 0 && $money > 0 && $client > 0){
|
||||
$pay_memberid = "API1362913582567500"; //商户CID
|
||||
$pay_orderid = 'E'.date("YmdHis").rand(100000,999999); //订单号
|
||||
$pay_amount = $money; //交易金额
|
||||
$pay_notifyurl = $pay_list['happyPay']['notify_url']; //服务端返回地址
|
||||
$pay_callbackurl = $pay_list['happyPay']['callback_url']; //页面跳转返回地址
|
||||
$Md5key = "77f4a079992f4e16b0d2cb4dbd1d7f0f"; //密钥
|
||||
$tjurl = "http://khgri4829.com:6084/api/pay/V2"; //提交地址
|
||||
$native = [
|
||||
'version'=>'V2',//版本号
|
||||
'signType'=>'MD5',//签名类型
|
||||
'merchantNo'=>$pay_memberid,//商户号
|
||||
'date'=>date('Ymdhis',time()),//时间戳格式:YYYYMMDDhhmmss
|
||||
'channleType'=>$pay_type,//通道类型
|
||||
'noticeUrl'=>$pay_notifyurl,
|
||||
'orderNo'=>$pay_orderid,
|
||||
'bizAmt'=>$pay_amount,
|
||||
];
|
||||
|
||||
|
||||
ksort($native);
|
||||
$md5str = "";
|
||||
foreach ($native as $key => $val) {
|
||||
$md5str = $md5str . $key . "=" . $val . "&";
|
||||
}
|
||||
$md5str = trim($md5str,'&');
|
||||
$sign = md5($md5str . $Md5key);
|
||||
$native["sign"] = $sign;
|
||||
|
||||
$postData = http_build_query($native);
|
||||
$options = array(
|
||||
'http' => array(
|
||||
'method' => 'POST',
|
||||
'header' =>[
|
||||
'Content-type:application/json',
|
||||
'Accept:application/json'
|
||||
],
|
||||
'content' => json_encode($native),
|
||||
'timeout' => 15 * 60 // 超时时间(单位:s)
|
||||
)
|
||||
);
|
||||
$context = stream_context_create($options);
|
||||
$result = file_get_contents($tjurl, false, $context);
|
||||
$returnArray = json_decode($result,true);
|
||||
// print_r($returnArray);die;
|
||||
if(is_array($returnArray) && isset($returnArray['code'])){
|
||||
if($returnArray['code'] == 0){
|
||||
|
||||
if(isset($returnArray['detail']['PayURL'])){
|
||||
$returnUrl = $returnArray['detail']['PayURL'];
|
||||
}else{
|
||||
$parms = base64_encode(encrypt_data(['user_id'=>$user_id,'orderNo'=>$pay_orderid]));
|
||||
$returnUrl = $pay_callbackurl.'?value='.$parms;
|
||||
}
|
||||
$order_record = array();
|
||||
$order_record['pay_channel_id'] = 5;
|
||||
$order_record['pay_channel_name'] = 'happyPay';
|
||||
$order_record['user_id'] = $user_id;
|
||||
$order_record['order_sn'] = $pay_orderid;
|
||||
$order_record['appid'] = $pay_memberid;
|
||||
$order_record['api_key'] = $Md5key;
|
||||
$order_record['money'] = $pay_amount;
|
||||
$order_record['sign'] = $sign;
|
||||
$order_record['create_time'] = time();
|
||||
$order_record['back_order_sn'] = '';
|
||||
$order_record['client'] = $client;
|
||||
|
||||
if(isset($returnArray['detail']['PayHtml'])){
|
||||
$order_record['remake'] = $returnArray['detail']['PayHtml'];
|
||||
}
|
||||
$order_id = Db::name('order_record')->insertGetId($order_record);
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 5;
|
||||
$order_log['pay_channel_name'] = 'happyPay';
|
||||
$order_log['money'] = $pay_amount;
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = 'user_id:'.$user_id.',用户名:'.$username.',发起充值:'.$pay_amount.',充值时间:'.date('Y-m-d H:i:s',time());
|
||||
$order_log['order_id'] = $order_id;
|
||||
$order_log['client'] = $client;
|
||||
Db::name('order_log')->insert($order_log);
|
||||
|
||||
return json(array('status' => 1, 'message' => '发起支付成功,即将跳转...', 'url' => $returnUrl));
|
||||
}else{
|
||||
return json(array('status' => 0, 'message' => $returnArray['msg']));
|
||||
}
|
||||
|
||||
}else{
|
||||
return json(array('status' => 0, 'message' => '支付发起失败,请稍后再试'));
|
||||
}
|
||||
}else{
|
||||
return json(array('status' => 0, 'message' => '支付发起失败,请稍后再试'));
|
||||
}
|
||||
}
|
||||
public function happy_call_back_url(){
|
||||
$getData = Request::instance()->get('value');
|
||||
$content = '页面或订单已失效或订单';
|
||||
if(base64_decode($getData)){
|
||||
$data = decrypt_data(['encryptData'=>base64_decode($getData)]);
|
||||
if(isset($data['orderNo']) && isset($data['user_id'])){
|
||||
$orderInfo = Db::name('order_record')->where(['order_sn'=>$data['orderNo'],'user_id'=>$data['user_id']])->find();
|
||||
if($orderInfo){
|
||||
if($orderInfo['status'] == 3){
|
||||
$content = '订单已完成';
|
||||
}else{
|
||||
$content = $orderInfo['remake'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$this->assign('content',$content);
|
||||
return $this->fetch();
|
||||
|
||||
}
|
||||
public function happy_call_back(){
|
||||
$post = Request::instance()->post();
|
||||
$serializeData = json_encode($post);
|
||||
if(!is_array($post) || !isset($post['orderNo']) || !isset($post['bizAmt']) || !isset($post['status']) || !isset($post['sign']) || !isset($post['status'])){
|
||||
Log::record($post,'error_pay_callback');
|
||||
exit();
|
||||
}
|
||||
|
||||
Log::record($post,'callback');
|
||||
|
||||
if($post['status'] != 1){
|
||||
Log::record($post,'fail_pay_callback');
|
||||
exit('SUCCESS');
|
||||
}
|
||||
$order = Db::name('order_record')->where(['order_sn'=>$post['orderNo']])->find();
|
||||
if(!$order){
|
||||
$order_log['pay_channel_id'] = 5;
|
||||
$order_log['pay_channel_name'] = 'happyPay';
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,但是查询不到订单号,回调内容:".$serializeData;
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('SUCCESS');//订单不存在,回调失败
|
||||
}
|
||||
$user = Db::name('user')->where(array('id' => $order['user_id'], 'status' => 1, 'is_delete' => 0, 'agent' => 0))->find();
|
||||
if(!$user){
|
||||
$update['status'] = 1;
|
||||
$update['remake'] = '收到回调,无法查询到会员';
|
||||
Db::name('order_record')->where('id',$order['id'])->update($update);
|
||||
$order_log['pay_channel_id'] = 5;
|
||||
$order_log['pay_channel_name'] = 'happyPay';
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,但是查询不到会员信息,会员可能已经删除或者停用,回调内容:".$serializeData;
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('SUCCESS');//用户不存在,回调失败
|
||||
}
|
||||
//验证签名
|
||||
$Md5key = "77f4a079992f4e16b0d2cb4dbd1d7f0f"; //密钥
|
||||
$postData = $post;
|
||||
unset($postData['sign']);
|
||||
ksort($postData);
|
||||
$md5str = "";
|
||||
foreach ($postData as $key => $val) {
|
||||
$md5str = $md5str . $key . "=" . $val . "&";
|
||||
}
|
||||
$md5str = trim($md5str,'&');
|
||||
$sign = md5($md5str . $Md5key);
|
||||
|
||||
if ($sign != $post['sign']) {
|
||||
$update['status'] = 1;
|
||||
$update['remake'] = '签名不对,交易暂停';
|
||||
Db::name('order_record')->where('id',$order['id'])->update($update);
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 5;
|
||||
$order_log['pay_channel_name'] = 'happyPay';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,但是签名不对,回调内容:".$serializeData;
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('SUCCESS');//签名不对,回调失败
|
||||
}
|
||||
|
||||
//返回金额
|
||||
if(round($post['bizAmt'],2) != $order['money']){
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 5;
|
||||
$order_log['pay_channel_name'] = 'happyPay';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,但是金额不对,回调内容:".$serializeData;
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('SUCCESS');//金额不对,回调失败
|
||||
}
|
||||
|
||||
//总代理金额
|
||||
$zdlIdArr = explode(',',$user['agent_parent_id_path']);
|
||||
$zdlId = $zdlIdArr[0];
|
||||
$zdl = Db::name('user')->where(array('id' => $zdlId, 'status' => 1, 'is_delete' => 0, 'agent' => 1))->find();
|
||||
if(!$zdl || $zdl['money'] < $order['money']){
|
||||
$update['status'] = 1;
|
||||
$update['remake'] = '无法找到总代理,或者总代理账号余分不足,交易暂停';
|
||||
Db::name('order_record')->where('id',$order['id'])->update($update);
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 5;
|
||||
$order_log['pay_channel_name'] = 'happyPay';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "无法找到总代理,或者总代理账号余分不足,回调内容:".$serializeData;
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('SUCCESS');//找不到总代理,回调失败
|
||||
}
|
||||
|
||||
|
||||
|
||||
//更新订单表
|
||||
$call_back_data['back_money'] = $post['bizAmt'];
|
||||
$call_back_data['back_sign'] = '';
|
||||
$call_back_data['back_time'] = time();
|
||||
|
||||
$call_back_data['status'] = 3;
|
||||
$call_back_data['agent_parent_id'] = $user['agent_parent_id'];
|
||||
$call_back_data['agent_parent_username'] = $user['agent_parent_username'];
|
||||
$call_back_data['zdl_id'] = $zdl['id'];
|
||||
$call_back_data['zdl_username'] = $zdl['username'];
|
||||
$call_back_data['zdl_money_before'] = $zdl['money'];
|
||||
$call_back_data['zdl_money_after'] = $zdl['money'] - $order['money'];
|
||||
$call_back_data['money_before'] = $user['money'];
|
||||
$call_back_data['money_after'] = $user['money'] + $order['money'];
|
||||
Db::name('order_record')->where(array('id' => $order['id']))->update($call_back_data);
|
||||
|
||||
//记录支付日志
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 5;
|
||||
$order_log['pay_channel_name'] = 'happyPay';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "回调支付成功";
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
//插入上分表并增加余分
|
||||
$recharge = array();
|
||||
$recharge['type'] = 4;
|
||||
$recharge['amount'] = $order['money'];
|
||||
$recharge['mode'] = 1;
|
||||
$recharge['agent_or_admin'] = 3;
|
||||
$recharge['controller_id'] = $zdl['id'];
|
||||
$recharge['controller_username'] = $zdl['username'];
|
||||
$recharge['controller_nickname'] = $zdl['nickname'];
|
||||
$recharge['controller_type'] = '第三方充值平台充值,扣取总代理余分';
|
||||
$recharge['controller_old_money'] = $zdl['money'];
|
||||
$recharge['controller_new_money'] = $zdl['money'] - $order['money'];
|
||||
$recharge['user_id'] = $order['user_id'];
|
||||
$recharge['user_type'] = $user['agent'];
|
||||
$recharge['user_agent_level'] = 0;
|
||||
$recharge['username_for'] = $user['username'];
|
||||
$recharge['nickname_for'] = $user['nickname'];
|
||||
$recharge['user_parent_id'] = $user['agent_parent_id'];
|
||||
$recharge['create_time'] = time();
|
||||
$recharge['old_money'] = $user['money'];
|
||||
$recharge['new_money'] = $user['money'] + $order['money'];
|
||||
$recharge['controller_system'] = 3;
|
||||
$recharge['remake'] = '第三方充值成功';
|
||||
Db::name('recharge')->insert($recharge);
|
||||
$updateZdl = array();
|
||||
$updateZdl['money'] = $zdl['money'] - $order['money'];
|
||||
$updateZdl['last_recharge_out'] = $order['money'];
|
||||
$updateZdl['last_recharge_out_time'] = time();
|
||||
$updateZdl['recharge_out_count'] = $zdl['recharge_out_count'] + 1;
|
||||
$updateZdl['recharge_out_total_amount'] = $zdl['recharge_out_total_amount'] + $order['money'];
|
||||
$updateUser = array();
|
||||
$updateUser['money'] = $user['money'] + $order['money'];
|
||||
$updateUser['last_recharge'] = $order['money'];
|
||||
$updateUser['last_recharge_time'] = time();
|
||||
$updateUser['recharge_count'] = $user['recharge_count'] + 1;
|
||||
$updateUser['recharge_total_amount'] = $user['recharge_total_amount'] + $order['money'];
|
||||
Db::name('user')->where(array('id' => $zdl['id']))->limit(1)->update($updateZdl);
|
||||
Db::name('user')->where(array('id' => $order['user_id']))->limit(1)->update($updateUser);
|
||||
exit('SUCCESS');
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
<?php
|
||||
namespace app\onlinechip\controller\traits;
|
||||
use think\Db;
|
||||
use think\Log;
|
||||
use think\Request;
|
||||
trait hengfuPay{
|
||||
public function hengfu_online_order(){
|
||||
$user_id = intval(Request::instance()->post('user_id'));
|
||||
$money = intval(Request::instance()->post('price'));
|
||||
$client = intval(Request::instance()->post('client'));
|
||||
$username = trim(Request::instance()->post('username'));
|
||||
$pay_type = intval(Request::instance()->post('pay_type'));
|
||||
$user = Db::name('user')->where(array('id' => $user_id, 'status' => 1, 'is_delete' => 0, 'agent' => 0))->find();
|
||||
$zdlIdArr = explode(',',$user['agent_parent_id_path']);
|
||||
$area_list = config('area_list');
|
||||
//判断是否金流支线,如果不是的话,不允许充值
|
||||
$isAllow = false;
|
||||
foreach($area_list[$user['area_id']]['limit_agent'] as $allowAgentId){
|
||||
if(in_array($allowAgentId,$zdlIdArr)){
|
||||
$isAllow = true;
|
||||
}
|
||||
}
|
||||
if(!$isAllow){
|
||||
return json(array('status' => 0, 'message' => '该账号暂不支持在线充值'));
|
||||
}
|
||||
$zdlId = $zdlIdArr[0];
|
||||
$zdl = Db::name('user')->where(array('id' => $zdlId, 'status' => 1, 'is_delete' => 0, 'agent' => 1))->find();
|
||||
if(!$zdl){
|
||||
return json(array('status' => 0, 'message' => '所属代理账号异常,暂不能充值'));
|
||||
}
|
||||
if($zdl['money'] < $money){
|
||||
return json(array('status' => 0, 'message' => '所属代理余额不足,暂不能充值'));
|
||||
}
|
||||
$pay_list = config('pay_list');
|
||||
if($user && $user_id > 0 && $money > 0 && $client > 0){
|
||||
$sn = '1965312301';
|
||||
$Authorization = 'aE86s4HKxKghfXLOmAPBKMIJymFedk6W99RJe4L9QOOwNvWFlKZgNyqfycP4lXVS';
|
||||
$PaymentType = $pay_type;
|
||||
$VendorSerialNumber = 'E'.date("YmdHis").rand(100000,999999); //订单号
|
||||
$SourceName = $user['username']; //来源名称
|
||||
$TransactionAmount = $money; //交易金额
|
||||
$CallBack = $pay_list['hengfuPay']['notify_url']; //回调返回地址
|
||||
$RedirectUrl = $pay_list['hengfuPay']['callback_url']; //页面跳转返回地址
|
||||
$curl = curl_init();
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => "https://hengfu.cool/api/2.0.0/recharge/order/",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => "sn=".$sn."&PaymentType=".$PaymentType."&TransactionAmount=".$TransactionAmount."&VendorSerialNumber=".$VendorSerialNumber."&CallBack=".$CallBack."&RedirectUrl=".$RedirectUrl."&SourceName=".$SourceName,
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
"Authorization: ".$Authorization,
|
||||
"Content-Type: application/x-www-form-urlencoded"
|
||||
),
|
||||
));
|
||||
$response = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
$response = json_decode($response,true);
|
||||
//echo "<pre>";
|
||||
//print_r($response);
|
||||
//echo "</pre>";
|
||||
//exit();
|
||||
if($response['api_status'] == true){
|
||||
$orderUrl = $response['data']['path'];
|
||||
$back_order_sn = $response['data']['serial_number'];
|
||||
//创建订单
|
||||
$order_record = array();
|
||||
$order_record['pay_channel_id'] = 6;
|
||||
$order_record['pay_channel_name'] = 'hengfuPay';
|
||||
$order_record['user_id'] = $user_id;
|
||||
$order_record['order_sn'] = $VendorSerialNumber;
|
||||
$order_record['appid'] = $sn;
|
||||
$order_record['api_key'] = $Authorization;
|
||||
$order_record['money'] = $TransactionAmount;
|
||||
$order_record['create_time'] = time();
|
||||
$order_record['back_order_sn'] = $back_order_sn ;
|
||||
$order_record['client'] = $client;
|
||||
$order_id = Db::name('order_record')->insertGetId($order_record);
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 6;
|
||||
$order_log['pay_channel_name'] = 'hengfuPay';
|
||||
$order_log['money'] = $TransactionAmount;
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = 'user_id:'.$user_id.',用户名:'.$username.',发起充值:'.$TransactionAmount.',充值时间:'.date('Y-m-d H:i:s',time());
|
||||
$order_log['order_id'] = $order_id;
|
||||
$order_log['client'] = $client;
|
||||
Db::name('order_log')->insert($order_log);
|
||||
return json(array('status' => 1, 'message' => '发起支付成功,即将跳转...', 'url' => $orderUrl));
|
||||
}else{
|
||||
return json(array('status' => 0, 'message' => $response['code']));
|
||||
}
|
||||
}else{
|
||||
return json(array('status' => 0, 'message' => '支付发起失败,请稍后再试'));
|
||||
}
|
||||
}
|
||||
public function hengfu_call_back(){
|
||||
if(Request::instance()->isPost()){
|
||||
$serializeData = Request::instance()->post('data');
|
||||
$post = json_decode(Request::instance()->post('data'), true);
|
||||
if(isset($post['Status']) && intval($post['Status']) == 3){
|
||||
$order = Db::name('order_record')->where(['order_sn' => $post['VendorSerialNumber']])->find();
|
||||
if(!$order){
|
||||
//订单不存在,回调失败
|
||||
$order_log['pay_channel_id'] = 6;
|
||||
$order_log['pay_channel_name'] = 'hengfuPay';
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,但是查询不到订单号,回调内容:".$serializeData;
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('OK');
|
||||
}
|
||||
$user = Db::name('user')->where(array('id' => $order['user_id'], 'status' => 1, 'is_delete' => 0, 'agent' => 0, 'username' => $post['SourceName']))->find();
|
||||
if(!$user){
|
||||
//用户不存在,回调失败
|
||||
$update['status'] = 1;
|
||||
$update['remake'] = '收到回调,无法查询到会员';
|
||||
Db::name('order_record')->where('id',$order['id'])->update($update);
|
||||
$order_log['pay_channel_id'] = 6;
|
||||
$order_log['pay_channel_name'] = 'hengfuPay';
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,但是查询不到会员信息,会员可能已经删除或者停用,回调内容:".$serializeData;
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('OK');
|
||||
}
|
||||
//验证签名
|
||||
$Md5key = "WYPJVZInmafDxRFCEc6Nn9Ss8FRG0U2FHaZ4sT8buxx0LCncIz9nM12dokbiJjWr";
|
||||
$postData = $post;
|
||||
unset($postData['Sign']);
|
||||
ksort($postData);
|
||||
$md5str = "";
|
||||
foreach ($postData as $key => $val) {
|
||||
$md5str = $md5str . $key . "=" . $val . "&";
|
||||
}
|
||||
$sign = md5($md5str . "Key=" . $Md5key);
|
||||
if ($sign != $post['Sign']) {
|
||||
//签名不对,回调失败
|
||||
$update['status'] = 1;
|
||||
$update['remake'] = '签名不对,交易暂停';
|
||||
Db::name('order_record')->where('id',$order['id'])->update($update);
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 6;
|
||||
$order_log['pay_channel_name'] = 'hengfuPay';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,但是签名不对,回调内容:".$serializeData;
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('OK');
|
||||
}
|
||||
//返回金额
|
||||
if(round($post['TransactionAmount'],2) != $order['money']){
|
||||
//金额不对,回调失败
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 6;
|
||||
$order_log['pay_channel_name'] = 'hengfuPay';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,但是金额不对,回调内容:".$serializeData;
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('success');
|
||||
}
|
||||
|
||||
//总代理金额
|
||||
$zdlIdArr = explode(',',$user['agent_parent_id_path']);
|
||||
$zdlId = $zdlIdArr[0];
|
||||
$zdl = Db::name('user')->where(array('id' => $zdlId, 'status' => 1, 'is_delete' => 0, 'agent' => 1))->find();
|
||||
if(!$zdl || $zdl['money'] < $order['money']){
|
||||
//找不到总代理,回调失败
|
||||
$update['status'] = 1;
|
||||
$update['remake'] = '无法找到总代理,或者总代理账号余分不足,交易暂停';
|
||||
Db::name('order_record')->where('id',$order['id'])->update($update);
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 6;
|
||||
$order_log['pay_channel_name'] = 'hengfuPay';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "无法找到总代理,或者总代理账号余分不足,回调内容:".$serializeData;
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('success');
|
||||
}
|
||||
//更新订单表
|
||||
$call_back_data['back_money'] = $post['TransactionAmount'];
|
||||
$call_back_data['back_sign'] = $post['Sign'];
|
||||
$call_back_data['back_time'] = time();
|
||||
|
||||
$call_back_data['status'] = 3;
|
||||
$call_back_data['agent_parent_id'] = $user['agent_parent_id'];
|
||||
$call_back_data['agent_parent_username'] = $user['agent_parent_username'];
|
||||
$call_back_data['zdl_id'] = $zdl['id'];
|
||||
$call_back_data['zdl_username'] = $zdl['username'];
|
||||
$call_back_data['zdl_money_before'] = $zdl['money'];
|
||||
$call_back_data['zdl_money_after'] = $zdl['money'] - $order['money'];
|
||||
$call_back_data['money_before'] = $user['money'];
|
||||
$call_back_data['money_after'] = $user['money'] + $order['money'];
|
||||
Db::name('order_record')->where(array('id' => $order['id']))->update($call_back_data);
|
||||
|
||||
//记录支付日志
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 6;
|
||||
$order_log['pay_channel_name'] = 'hengfuPay';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "回调支付成功";
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
//插入上分表并增加余分
|
||||
$recharge = array();
|
||||
$recharge['type'] = 4;
|
||||
$recharge['amount'] = $order['money'];
|
||||
$recharge['mode'] = 1;
|
||||
$recharge['agent_or_admin'] = 3;
|
||||
$recharge['controller_id'] = $zdl['id'];
|
||||
$recharge['controller_username'] = $zdl['username'];
|
||||
$recharge['controller_nickname'] = $zdl['nickname'];
|
||||
$recharge['controller_type'] = '第三方充值平台充值,扣取总代理余分';
|
||||
$recharge['controller_old_money'] = $zdl['money'];
|
||||
$recharge['controller_new_money'] = $zdl['money'] - $order['money'];
|
||||
$recharge['user_id'] = $order['user_id'];
|
||||
$recharge['user_type'] = $user['agent'];
|
||||
$recharge['user_agent_level'] = 0;
|
||||
$recharge['username_for'] = $user['username'];
|
||||
$recharge['nickname_for'] = $user['nickname'];
|
||||
$recharge['user_parent_id'] = $user['agent_parent_id'];
|
||||
$recharge['create_time'] = time();
|
||||
$recharge['old_money'] = $user['money'];
|
||||
$recharge['new_money'] = $user['money'] + $order['money'];
|
||||
$recharge['controller_system'] = 3;
|
||||
$recharge['remake'] = '第三方充值成功';
|
||||
Db::name('recharge')->insert($recharge);
|
||||
$updateZdl = array();
|
||||
$updateZdl['money'] = $zdl['money'] - $order['money'];
|
||||
$updateZdl['last_recharge_out'] = $order['money'];
|
||||
$updateZdl['last_recharge_out_time'] = time();
|
||||
$updateZdl['recharge_out_count'] = $zdl['recharge_out_count'] + 1;
|
||||
$updateZdl['recharge_out_total_amount'] = $zdl['recharge_out_total_amount'] + $order['money'];
|
||||
$updateUser = array();
|
||||
$updateUser['money'] = $user['money'] + $order['money'];
|
||||
$updateUser['last_recharge'] = $order['money'];
|
||||
$updateUser['last_recharge_time'] = time();
|
||||
$updateUser['recharge_count'] = $user['recharge_count'] + 1;
|
||||
$updateUser['recharge_total_amount'] = $user['recharge_total_amount'] + $order['money'];
|
||||
Db::name('user')->where(array('id' => $zdl['id']))->limit(1)->update($updateZdl);
|
||||
Db::name('user')->where(array('id' => $order['user_id']))->limit(1)->update($updateUser);
|
||||
exit('OK');
|
||||
}else{
|
||||
Log::record(Request::instance()->post(),'error_pay_callback');
|
||||
exit('OK');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
<?php
|
||||
namespace app\onlinechip\controller\traits;
|
||||
use think\Db;
|
||||
use think\Log;
|
||||
use think\Request;
|
||||
|
||||
trait hipPay{
|
||||
|
||||
/**
|
||||
* 创建支付订单和返回支付链接
|
||||
* @return \think\response\Json
|
||||
* DateTime: 2019/12/27 18:42
|
||||
*/
|
||||
public function hip_online_order(){
|
||||
$user_id = intval(Request::instance()->post('user_id'));
|
||||
$money = intval(Request::instance()->post('price'));
|
||||
$client = intval(Request::instance()->post('client'));
|
||||
$username = trim(Request::instance()->post('username'));
|
||||
$user = Db::name('user')->where(array('id' => $user_id, 'status' => 1, 'is_delete' => 0, 'agent' => 0))->find();
|
||||
$zdlIdArr = explode(',',$user['agent_parent_id_path']);
|
||||
|
||||
$area_list = config('area_list');
|
||||
//判断是否金流支线,如果不是的话,不允许充值
|
||||
$isAllow = false;
|
||||
foreach($area_list[$user['area_id']]['limit_agent'] as $allowAgentId){
|
||||
if(in_array($allowAgentId,$zdlIdArr)){
|
||||
$isAllow = true;
|
||||
}
|
||||
}
|
||||
if(!$isAllow){
|
||||
return json(array('status' => 0, 'message' => '该账号暂不支持在线充值'));
|
||||
}
|
||||
|
||||
$zdlId = $zdlIdArr[0];
|
||||
$zdl = Db::name('user')->where(array('id' => $zdlId, 'status' => 1, 'is_delete' => 0, 'agent' => 1))->find();
|
||||
if(!$zdl){
|
||||
return json(array('status' => 0, 'message' => '所属代理账号异常,暂不能充值'));
|
||||
}
|
||||
if($zdl['money'] < $money){
|
||||
return json(array('status' => 0, 'message' => '所属代理余额不足,暂不能充值'));
|
||||
}
|
||||
$pay_list = config('pay_list');
|
||||
if($user && $user_id > 0 && $money > 0 && $client > 0){
|
||||
$pay_orderid = date("YmdHis").rand(10,99); //订单号
|
||||
$pay_amount = $money; //交易金额
|
||||
$pay_notifyurl = $pay_list['hipPay']['callback_url']; //服务端返回地址
|
||||
$pay_notifyurl_page = $pay_list['hipPay']['notify_url']; //服务端返回地址--页面
|
||||
$tjurl = "http://www.hip168.net/api/getway01/CodeRequest.ashx"; //提交地址
|
||||
$native = [
|
||||
'Merchent'=>'JF',
|
||||
'OrderID'=>$pay_orderid,
|
||||
'Total'=>$pay_amount,
|
||||
'ReAUrl'=>$pay_notifyurl,
|
||||
'ReBUrl'=>$pay_notifyurl_page,
|
||||
'Name'=>$user['username']
|
||||
];
|
||||
$postData = http_build_query($native);
|
||||
$orderUrl = $tjurl.'?'.$postData;
|
||||
//创建订单
|
||||
$order_record = array();
|
||||
$order_record['pay_channel_id'] = 3;
|
||||
$order_record['pay_channel_name'] = 'hipPay';
|
||||
$order_record['user_id'] = $user_id;
|
||||
$order_record['order_sn'] = $pay_orderid;
|
||||
$order_record['appid'] = 0;//不需要
|
||||
$order_record['api_key'] = '';//不需要
|
||||
$order_record['money'] = $pay_amount;
|
||||
$order_record['sign'] = '';//不需要
|
||||
$order_record['create_time'] = time();
|
||||
$order_record['back_order_sn'] = '';
|
||||
$order_record['client'] = $client;
|
||||
$order_id = Db::name('order_record')->insertGetId($order_record);
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 3;
|
||||
$order_log['pay_channel_name'] = 'hipPay';
|
||||
$order_log['money'] = $pay_amount;
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = 'user_id:'.$user_id.',用户名:'.$username.',发起充值:'.$pay_amount.',充值时间:'.date('Y-m-d H:i:s',time());
|
||||
$order_log['order_id'] = $order_id;
|
||||
$order_log['client'] = $client;
|
||||
Db::name('order_log')->insert($order_log);
|
||||
return json(array('status' => 1, 'message' => '发起支付成功,即将跳转...', 'url' => $orderUrl));
|
||||
}else{
|
||||
return json(array('status' => 0, 'message' => '支付发起失败,请稍后再试'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 支付码显示页面
|
||||
* @return mixed
|
||||
* @throws \think\Exception
|
||||
* DateTime: 2020/1/10 15:32
|
||||
*/
|
||||
public function hip_call_back_url(){
|
||||
if(Request::instance()->get()){
|
||||
$Ordernum = Request::instance()->get('Ordernum');
|
||||
$StoreCode = Request::instance()->get('StoreCode');
|
||||
$Total = Request::instance()->get('Total');
|
||||
$mobileUrl = Request::instance()->get('mobileUrl');
|
||||
if($Ordernum && $StoreCode && $Total && $mobileUrl){
|
||||
$order = Db::name('order_record')->where(['order_sn'=>$Ordernum,'status'=>0])->find();
|
||||
if($order && $order['money'] == $Total){
|
||||
Db::name('order_record')->where(['id'=>$order['id']])->update(['back_order_sn'=>$StoreCode]);
|
||||
$this->assign('StoreCode',$StoreCode);
|
||||
$this->assign('Total',$Total);
|
||||
$this->assign('mobileUrl',$mobileUrl);
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 充值回调
|
||||
* @throws \think\Exception
|
||||
* DateTime: 2019/12/30 13:49
|
||||
*/
|
||||
public function hip_call_back(){
|
||||
$get = Request::instance()->get();
|
||||
$serializeData = json_encode($get);
|
||||
if(getIP() != '203.66.45.226'){
|
||||
Log::record(array_merge($get,['ip'=>getIP()]),'error_pay_callback_illegal_request');//非法请求
|
||||
exit();
|
||||
}
|
||||
|
||||
$Ordernum = Request::instance()->get('Ordernum');
|
||||
$StoreCode = Request::instance()->get('StoreCode');
|
||||
$Status = Request::instance()->get('Status');
|
||||
$Total = Request::instance()->get('Total');
|
||||
|
||||
Log::record(Request::instance()->get(),'callback');
|
||||
if($Status != '0000' || !$StoreCode || !$Ordernum || !$Total){
|
||||
Log::record(Request::instance()->get(),'error_pay_callback');
|
||||
exit();
|
||||
}
|
||||
$order = Db::name('order_record')->where(['order_sn'=>$Ordernum,'back_order_sn'=>$StoreCode])->find();
|
||||
if(!$order){
|
||||
$order_log['pay_channel_id'] = 3;
|
||||
$order_log['pay_channel_name'] = 'hipPay';
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,但是查询不到订单号,回调内容:".$serializeData;
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('OK');//订单不存在,回调失败
|
||||
}
|
||||
$user = Db::name('user')->where(array('id' => $order['user_id'], 'status' => 1, 'is_delete' => 0, 'agent' => 0))->find();
|
||||
if(!$user){
|
||||
$update['status'] = 1;
|
||||
$update['remake'] = '收到回调,无法查询到会员';
|
||||
Db::name('order_record')->where('id',$order['id'])->update($update);
|
||||
$order_log['pay_channel_id'] = 3;
|
||||
$order_log['pay_channel_name'] = 'hipPay';
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,但是查询不到会员信息,会员可能已经删除或者停用,回调内容:".$serializeData;
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('OK');//用户不存在,回调失败
|
||||
}
|
||||
|
||||
//返回金额
|
||||
if($Total != $order['money']){
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 3;
|
||||
$order_log['pay_channel_name'] = 'hipPay';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,但是金额不对,回调内容:".$serializeData;
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('OK');//金额不对,回调失败
|
||||
}
|
||||
|
||||
//总代理金额
|
||||
$zdlIdArr = explode(',',$user['agent_parent_id_path']);
|
||||
$zdlId = $zdlIdArr[0];
|
||||
$zdl = Db::name('user')->where(array('id' => $zdlId, 'status' => 1, 'is_delete' => 0, 'agent' => 1))->find();
|
||||
if(!$zdl || $zdl['money'] < $order['money']){
|
||||
$update['status'] = 1;
|
||||
$update['remake'] = '无法找到总代理,或者总代理账号余分不足,交易暂停';
|
||||
Db::name('order_record')->where('id',$order['id'])->update($update);
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 3;
|
||||
$order_log['pay_channel_name'] = 'hipPay';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "无法找到总代理,或者总代理账号余分不足,回调内容:".$serializeData;
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('OK');//找不到总代理,回调失败
|
||||
}
|
||||
|
||||
//更新订单表
|
||||
$call_back_data['back_money'] = $Total;
|
||||
$call_back_data['back_sign'] = '';
|
||||
$call_back_data['back_time'] = time();
|
||||
|
||||
$call_back_data['status'] = 3;
|
||||
$call_back_data['agent_parent_id'] = $user['agent_parent_id'];
|
||||
$call_back_data['agent_parent_username'] = $user['agent_parent_username'];
|
||||
$call_back_data['zdl_id'] = $zdl['id'];
|
||||
$call_back_data['zdl_username'] = $zdl['username'];
|
||||
$call_back_data['zdl_money_before'] = $zdl['money'];
|
||||
$call_back_data['zdl_money_after'] = $zdl['money'] - $order['money'];
|
||||
$call_back_data['money_before'] = $user['money'];
|
||||
$call_back_data['money_after'] = $user['money'] + $order['money'];
|
||||
Db::name('order_record')->where(array('id' => $order['id']))->update($call_back_data);
|
||||
|
||||
//记录支付日志
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 3;
|
||||
$order_log['pay_channel_name'] = 'hipPay';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "回调支付成功";
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
//插入上分表并增加余分
|
||||
$recharge = array();
|
||||
$recharge['type'] = 4;
|
||||
$recharge['amount'] = $order['money'];
|
||||
$recharge['mode'] = 1;
|
||||
$recharge['agent_or_admin'] = 3;
|
||||
$recharge['controller_id'] = $zdl['id'];
|
||||
$recharge['controller_username'] = $zdl['username'];
|
||||
$recharge['controller_nickname'] = $zdl['nickname'];
|
||||
$recharge['controller_type'] = '第三方充值平台充值,扣取总代理余分';
|
||||
$recharge['controller_old_money'] = $zdl['money'];
|
||||
$recharge['controller_new_money'] = $zdl['money'] - $order['money'];
|
||||
$recharge['user_id'] = $order['user_id'];
|
||||
$recharge['user_type'] = $user['agent'];
|
||||
$recharge['user_agent_level'] = 0;
|
||||
$recharge['username_for'] = $user['username'];
|
||||
$recharge['nickname_for'] = $user['nickname'];
|
||||
$recharge['user_parent_id'] = $user['agent_parent_id'];
|
||||
$recharge['create_time'] = time();
|
||||
$recharge['old_money'] = $user['money'];
|
||||
$recharge['new_money'] = $user['money'] + $order['money'];
|
||||
$recharge['controller_system'] = 3;
|
||||
$recharge['remake'] = '第三方充值成功';
|
||||
Db::name('recharge')->insert($recharge);
|
||||
$updateZdl = array();
|
||||
$updateZdl['money'] = $zdl['money'] - $order['money'];
|
||||
$updateZdl['last_recharge_out'] = $order['money'];
|
||||
$updateZdl['last_recharge_out_time'] = time();
|
||||
$updateZdl['recharge_out_count'] = $zdl['recharge_out_count'] + 1;
|
||||
$updateZdl['recharge_out_total_amount'] = $zdl['recharge_out_total_amount'] + $order['money'];
|
||||
$updateUser = array();
|
||||
$updateUser['money'] = $user['money'] + $order['money'];
|
||||
$updateUser['last_recharge'] = $order['money'];
|
||||
$updateUser['last_recharge_time'] = time();
|
||||
$updateUser['recharge_count'] = $user['recharge_count'] + 1;
|
||||
$updateUser['recharge_total_amount'] = $user['recharge_total_amount'] + $order['money'];
|
||||
Db::name('user')->where(array('id' => $zdl['id']))->limit(1)->update($updateZdl);
|
||||
Db::name('user')->where(array('id' => $order['user_id']))->limit(1)->update($updateUser);
|
||||
exit('OK');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
<?php
|
||||
namespace app\onlinechip\controller\traits;
|
||||
use think\Db;
|
||||
use think\Log;
|
||||
use think\Request;
|
||||
|
||||
trait oneGoPay{
|
||||
|
||||
/**
|
||||
* 创建支付订单和返回支付链接
|
||||
* @return \think\response\Json
|
||||
* DateTime: 2019/12/27 18:42
|
||||
*/
|
||||
public function ogp_online_order(){
|
||||
$user_id = intval(Request::instance()->post('user_id'));
|
||||
$money = intval(Request::instance()->post('price'));
|
||||
$client = intval(Request::instance()->post('client'));
|
||||
$username = trim(Request::instance()->post('username'));
|
||||
$user = Db::name('user')->where(array('id' => $user_id, 'status' => 1, 'is_delete' => 0, 'agent' => 0))->find();
|
||||
$zdlIdArr = explode(',',$user['agent_parent_id_path']);
|
||||
|
||||
$area_list = config('area_list');
|
||||
//判断是否金流支线,如果不是的话,不允许充值
|
||||
$isAllow = false;
|
||||
foreach($area_list[$user['area_id']]['limit_agent'] as $allowAgentId){
|
||||
if(in_array($allowAgentId,$zdlIdArr)){
|
||||
$isAllow = true;
|
||||
}
|
||||
}
|
||||
if(!$isAllow){
|
||||
return json(array('status' => 0, 'message' => '该账号暂不支持在线充值'));
|
||||
}
|
||||
|
||||
$zdlId = $zdlIdArr[0];
|
||||
$zdl = Db::name('user')->where(array('id' => $zdlId, 'status' => 1, 'is_delete' => 0, 'agent' => 1))->find();
|
||||
if(!$zdl){
|
||||
return json(array('status' => 0, 'message' => '所属代理账号异常,暂不能充值'));
|
||||
}
|
||||
if($zdl['money'] < $money){
|
||||
return json(array('status' => 0, 'message' => '所属代理余额不足,暂不能充值'));
|
||||
}
|
||||
$pay_list = config('pay_list');
|
||||
if($user && $user_id > 0 && $money > 0 && $client > 0){
|
||||
$pay_orderid = 'E'.date("YmdHis").rand(100000,999999); //订单号
|
||||
$pay_amount = $money; //交易金额
|
||||
$pay_notifyurl = $pay_list['oneGoPay']['notify_url']; //服务端返回地址
|
||||
$api_token = '2I8WenxoXshAyDDJsDE1NkBfYjqTKY4ZUGJB0Y6s2lmSueFRxv4pRXfi5909';//api token
|
||||
$tjurl = "https://www.waterpay88.com/api/transaction"; //提交地址
|
||||
$native = [
|
||||
'amount'=>$pay_amount,
|
||||
'out_trade_no'=>$pay_orderid,
|
||||
'notify_url'=>$pay_notifyurl,
|
||||
];
|
||||
$postData = http_build_query($native);
|
||||
$options = array(
|
||||
'http' => array(
|
||||
'method' => 'POST',
|
||||
'header' =>[
|
||||
'Content-type:application/json',
|
||||
"Authorization:Bearer $api_token",
|
||||
'Accept:application/json'
|
||||
],
|
||||
'content' => json_encode($native),
|
||||
'timeout' => 15 * 60 // 超时时间(单位:s)
|
||||
)
|
||||
);
|
||||
$context = stream_context_create($options);
|
||||
$result = file_get_contents($tjurl, false, $context);
|
||||
$returnArray = json_decode($result,true);
|
||||
if(is_array($returnArray) && isset($returnArray['uri'])){
|
||||
$order_record = array();
|
||||
$order_record['pay_channel_id'] = 2;
|
||||
$order_record['pay_channel_name'] = 'oneGoPay';
|
||||
$order_record['user_id'] = $user_id;
|
||||
$order_record['order_sn'] = $pay_orderid;
|
||||
$order_record['appid'] = 0;//不需要
|
||||
$order_record['api_key'] = '';//不需要
|
||||
$order_record['money'] = $pay_amount;
|
||||
$order_record['sign'] = '';//不需要
|
||||
$order_record['create_time'] = time();
|
||||
$order_record['back_order_sn'] = $returnArray['trade_no'];
|
||||
$order_record['client'] = $client;
|
||||
$order_id = Db::name('order_record')->insertGetId($order_record);
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 2;
|
||||
$order_log['pay_channel_name'] = 'oneGoPay';
|
||||
$order_log['money'] = $pay_amount;
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = 'user_id:'.$user_id.',用户名:'.$username.',发起充值:'.$pay_amount.',充值时间:'.date('Y-m-d H:i:s',time());
|
||||
$order_log['order_id'] = $order_id;
|
||||
$order_log['client'] = $client;
|
||||
Db::name('order_log')->insert($order_log);
|
||||
return json(array('status' => 1, 'message' => '发起支付成功,即将跳转...', 'url' => $returnArray['uri']));
|
||||
}else{
|
||||
return json(array('status' => 0, 'message' => '支付发起失败,请稍后再试'));
|
||||
}
|
||||
}else{
|
||||
return json(array('status' => 0, 'message' => '支付发起失败,请稍后再试'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 充值回调
|
||||
* @throws \think\Exception
|
||||
* DateTime: 2019/12/30 13:49
|
||||
*/
|
||||
public function ogp_call_back(){
|
||||
$post = Request::instance()->post();
|
||||
$serializePost = json_encode($post);
|
||||
Log::record(Request::instance()->post(),'callback');
|
||||
if(!is_array($post) || !isset($post['status']) || $post['status'] != 'success'){
|
||||
Log::record(Request::instance()->post(),'error_pay_callback');
|
||||
exit();
|
||||
}
|
||||
$order = Db::name('order_record')->where('order_sn',$post['out_trade_no'])->find();
|
||||
if(!$order){
|
||||
$order_log['pay_channel_id'] = 2;
|
||||
$order_log['pay_channel_name'] = 'oneGoPay';
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,但是查询不到订单号,回调内容:".$serializePost;
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('OK');//订单不存在,回调失败
|
||||
}
|
||||
$user = Db::name('user')->where(array('id' => $order['user_id'], 'status' => 1, 'is_delete' => 0, 'agent' => 0))->find();
|
||||
if(!$user){
|
||||
$update['status'] = 1;
|
||||
$update['remake'] = '收到回调,无法查询到会员';
|
||||
Db::name('order_record')->where('id',$order['id'])->update($update);
|
||||
$order_log['pay_channel_id'] = 2;
|
||||
$order_log['pay_channel_name'] = 'oneGoPay';
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,但是查询不到会员信息,会员可能已经删除或者停用,回调内容:".$serializePost;
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('OK');//用户不存在,回调失败
|
||||
}
|
||||
|
||||
//返回金额
|
||||
if($post['amount'] != $order['money']){
|
||||
$update['status'] = 1;
|
||||
$update['remake'] = '支付金额小于订单金额,交易停止';
|
||||
Db::name('order_record')->where('id',$order['id'])->update($update);
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 2;
|
||||
$order_log['pay_channel_name'] = 'oneGoPay';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,但是金额不对,回调内容:".$serializePost;
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('OK');//金额不对,回调失败
|
||||
}
|
||||
|
||||
//总代理金额
|
||||
$zdlIdArr = explode(',',$user['agent_parent_id_path']);
|
||||
$zdlId = $zdlIdArr[0];
|
||||
$zdl = Db::name('user')->where(array('id' => $zdlId, 'status' => 1, 'is_delete' => 0, 'agent' => 1))->find();
|
||||
if(!$zdl || $zdl['money'] < $order['money']){
|
||||
$update['status'] = 1;
|
||||
$update['remake'] = '无法找到总代理,或者总代理账号余分不足,交易暂停';
|
||||
Db::name('order_record')->where('id',$order['id'])->update($update);
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 2;
|
||||
$order_log['pay_channel_name'] = 'oneGoPay';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "无法找到总代理,或者总代理账号余分不足,回调内容:".$serializePost;
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('OK');//找不到总代理,回调失败
|
||||
}
|
||||
|
||||
//更新订单表
|
||||
$call_back_data['back_money'] = $post['amount'];
|
||||
$call_back_data['back_sign'] = '';
|
||||
$call_back_data['back_time'] = time();
|
||||
|
||||
$call_back_data['status'] = 3;
|
||||
$call_back_data['agent_parent_id'] = $user['agent_parent_id'];
|
||||
$call_back_data['agent_parent_username'] = $user['agent_parent_username'];
|
||||
$call_back_data['zdl_id'] = $zdl['id'];
|
||||
$call_back_data['zdl_username'] = $zdl['username'];
|
||||
$call_back_data['zdl_money_before'] = $zdl['money'];
|
||||
$call_back_data['zdl_money_after'] = $zdl['money'] - $order['money'];
|
||||
$call_back_data['money_before'] = $user['money'];
|
||||
$call_back_data['money_after'] = $user['money'] + $order['money'];
|
||||
Db::name('order_record')->where(array('id' => $order['id']))->update($call_back_data);
|
||||
|
||||
//记录支付日志
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 2;
|
||||
$order_log['pay_channel_name'] = 'oneGoPay';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "回调支付成功";
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
//插入上分表并增加余分
|
||||
$recharge = array();
|
||||
$recharge['type'] = 4;
|
||||
$recharge['amount'] = $order['money'];
|
||||
$recharge['mode'] = 1;
|
||||
$recharge['agent_or_admin'] = 3;
|
||||
$recharge['controller_id'] = $zdl['id'];
|
||||
$recharge['controller_username'] = $zdl['username'];
|
||||
$recharge['controller_nickname'] = $zdl['nickname'];
|
||||
$recharge['controller_type'] = '第三方充值平台充值,扣取总代理余分';
|
||||
$recharge['controller_old_money'] = $zdl['money'];
|
||||
$recharge['controller_new_money'] = $zdl['money'] - $order['money'];
|
||||
$recharge['user_id'] = $order['user_id'];
|
||||
$recharge['user_type'] = $user['agent'];
|
||||
$recharge['user_agent_level'] = 0;
|
||||
$recharge['username_for'] = $user['username'];
|
||||
$recharge['nickname_for'] = $user['nickname'];
|
||||
$recharge['user_parent_id'] = $user['agent_parent_id'];
|
||||
$recharge['create_time'] = time();
|
||||
$recharge['old_money'] = $user['money'];
|
||||
$recharge['new_money'] = $user['money'] + $order['money'];
|
||||
$recharge['controller_system'] = 3;
|
||||
$recharge['remake'] = '第三方充值成功';
|
||||
Db::name('recharge')->insert($recharge);
|
||||
$updateZdl = array();
|
||||
$updateZdl['money'] = $zdl['money'] - $order['money'];
|
||||
$updateZdl['last_recharge_out'] = $order['money'];
|
||||
$updateZdl['last_recharge_out_time'] = time();
|
||||
$updateZdl['recharge_out_count'] = $zdl['recharge_out_count'] + 1;
|
||||
$updateZdl['recharge_out_total_amount'] = $zdl['recharge_out_total_amount'] + $order['money'];
|
||||
$updateUser = array();
|
||||
$updateUser['money'] = $user['money'] + $order['money'];
|
||||
$updateUser['last_recharge'] = $order['money'];
|
||||
$updateUser['last_recharge_time'] = time();
|
||||
$updateUser['recharge_count'] = $user['recharge_count'] + 1;
|
||||
$updateUser['recharge_total_amount'] = $user['recharge_total_amount'] + $order['money'];
|
||||
Db::name('user')->where(array('id' => $zdl['id']))->limit(1)->update($updateZdl);
|
||||
Db::name('user')->where(array('id' => $order['user_id']))->limit(1)->update($updateUser);
|
||||
exit('OK');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,267 @@
|
||||
<?php
|
||||
namespace app\onlinechip\controller\traits;
|
||||
use think\Db;
|
||||
use think\Log;
|
||||
use think\Request;
|
||||
trait tingPay{
|
||||
|
||||
|
||||
public function ting_online_order(){
|
||||
$user_id = intval(Request::instance()->post('user_id'));
|
||||
$money = intval(Request::instance()->post('price'));
|
||||
$client = intval(Request::instance()->post('client'));
|
||||
$username = trim(Request::instance()->post('username'));
|
||||
$pay_type = intval(Request::instance()->post('pay_type'));
|
||||
$user = Db::name('user')->where(array('id' => $user_id, 'status' => 1, 'is_delete' => 0, 'agent' => 0))->find();
|
||||
$zdlIdArr = explode(',',$user['agent_parent_id_path']);
|
||||
$area_list = config('area_list');
|
||||
//判断是否金流支线,如果不是的话,不允许充值
|
||||
$isAllow = false;
|
||||
foreach($area_list[$user['area_id']]['limit_agent'] as $allowAgentId){
|
||||
if(in_array($allowAgentId,$zdlIdArr)){
|
||||
$isAllow = true;
|
||||
}
|
||||
}
|
||||
if(!$isAllow){
|
||||
return json(array('status' => 0, 'message' => '该账号暂不支持在线充值'));
|
||||
}
|
||||
$zdlId = $zdlIdArr[0];
|
||||
$zdl = Db::name('user')->where(array('id' => $zdlId, 'status' => 1, 'is_delete' => 0, 'agent' => 1))->find();
|
||||
if(!$zdl){
|
||||
return json(array('status' => 0, 'message' => '所属代理账号异常,暂不能充值'));
|
||||
}
|
||||
if($zdl['money'] < $money){
|
||||
return json(array('status' => 0, 'message' => '所属代理余额不足,暂不能充值'));
|
||||
}
|
||||
$pay_list = config('pay_list');
|
||||
if($user && $user_id > 0 && $money > 0 && $client > 0){
|
||||
$pay_memberid = "3359"; //商户CID
|
||||
$pay_orderid = 'E'.date("YmdHis").rand(100000,999999); //订单号
|
||||
$pay_amount = $money; //交易金额
|
||||
$pay_notifyurl = $pay_list['tingPay']['notify_url']; //服务端返回地址
|
||||
$pay_callbackurl = $pay_list['tingPay']['callback_url']; //页面跳转返回地址
|
||||
$Md5key = "n7cznODIaFsY75BS1FLidCKaHAoKWtKHn5gSoQqnokNMzLtacFeyZ1Z9elkXHGXy"; //密钥
|
||||
$tjurl = "https://www.istmys.com/tingapi/jump"; //提交地址
|
||||
$native = [
|
||||
'merid' => $pay_memberid,//商户CID
|
||||
'amount' => $pay_amount,//充值金额
|
||||
'orderid' => $pay_orderid,//订单号
|
||||
'userid'=>$user_id,//会员ID
|
||||
'userip' => getIP(),//用户IP
|
||||
//'pay_type'=>$pay_type,//支付方式
|
||||
//'paytype'=> 'qrcode',
|
||||
//'bankflag'=> 'ALIPAY',
|
||||
'notifyurl' => $pay_notifyurl,//回调地址
|
||||
'syncurl' => $pay_callbackurl,//跳转地址
|
||||
];
|
||||
|
||||
ksort($native);
|
||||
$md5str = "";
|
||||
foreach ($native as $key => $val) {
|
||||
$md5str = $md5str . $key . "=" . $val . "&";
|
||||
}
|
||||
$sign = md5($md5str . "key=" . $Md5key);
|
||||
$native["sign"] = $sign;
|
||||
|
||||
$postData = http_build_query($native);
|
||||
$orderUrl = $tjurl.'?'.$postData;
|
||||
//创建订单
|
||||
$order_record = array();
|
||||
$order_record['pay_channel_id'] = 4;
|
||||
$order_record['pay_channel_name'] = 'tingPay';
|
||||
$order_record['user_id'] = $user_id;
|
||||
$order_record['order_sn'] = $pay_orderid;
|
||||
$order_record['appid'] = $pay_memberid;
|
||||
// $order_record['api_key'] = $Md5key;
|
||||
$order_record['api_key'] = '';//超出超度无法保存sql
|
||||
$order_record['money'] = $pay_amount;
|
||||
// $order_record['sign'] = $sign;
|
||||
$order_record['sign'] = '';//超出超度无法保存sql
|
||||
$order_record['create_time'] = time();
|
||||
$order_record['back_order_sn'] = '';
|
||||
$order_record['client'] = $client;
|
||||
$order_id = Db::name('order_record')->insertGetId($order_record);
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 4;
|
||||
$order_log['pay_channel_name'] = 'tingPay';
|
||||
$order_log['money'] = $pay_amount;
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = 'user_id:'.$user_id.',用户名:'.$username.',发起充值:'.$pay_amount.',充值时间:'.date('Y-m-d H:i:s',time());
|
||||
$order_log['order_id'] = $order_id;
|
||||
$order_log['client'] = $client;
|
||||
Db::name('order_log')->insert($order_log);
|
||||
return json(array('status' => 1, 'message' => '发起支付成功,即将跳转...', 'url' => $orderUrl));
|
||||
}else{
|
||||
return json(array('status' => 0, 'message' => '支付发起失败,请稍后再试'));
|
||||
}
|
||||
}
|
||||
public function ting_call_back_url(){
|
||||
Log::record(Request::instance()->post(),'callback');
|
||||
exit();
|
||||
}
|
||||
public function ting_call_back(){
|
||||
// $serializeData = Request::instance()->post();
|
||||
// $post = json_decode($serializeData);
|
||||
$post = Request::instance()->post();
|
||||
$serializeData = json_encode($post);
|
||||
if(!is_array($post) || !isset($post['merid']) || !isset($post['userid']) || !isset($post['amount']) || !isset($post['orderid']) || !isset($post['sign']) || !isset($post['status'])){
|
||||
Log::record($post,'error_pay_callback');
|
||||
exit();
|
||||
}
|
||||
|
||||
Log::record($post,'callback');
|
||||
|
||||
if($post['status'] != 'verified'){
|
||||
Log::record($post,'fail_pay_callback');
|
||||
exit();
|
||||
}
|
||||
$order = Db::name('order_record')->where(['order_sn'=>$post['orderid'],'user_id'=>$post['userid']])->find();
|
||||
if(!$order){
|
||||
$order_log['pay_channel_id'] = 4;
|
||||
$order_log['pay_channel_name'] = 'tingPay';
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,但是查询不到订单号,回调内容:".$serializeData;
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('OK');//订单不存在,回调失败
|
||||
}
|
||||
$user = Db::name('user')->where(array('id' => $order['user_id'], 'status' => 1, 'is_delete' => 0, 'agent' => 0))->find();
|
||||
if(!$user){
|
||||
$update['status'] = 1;
|
||||
$update['remake'] = '收到回调,无法查询到会员';
|
||||
Db::name('order_record')->where('id',$order['id'])->update($update);
|
||||
$order_log['pay_channel_id'] = 4;
|
||||
$order_log['pay_channel_name'] = 'tingPay';
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,但是查询不到会员信息,会员可能已经删除或者停用,回调内容:".$serializeData;
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('OK');//用户不存在,回调失败
|
||||
}
|
||||
//验证签名
|
||||
$Md5key = "n7cznODIaFsY75BS1FLidCKaHAoKWtKHn5gSoQqnokNMzLtacFeyZ1Z9elkXHGXy"; //密钥
|
||||
$postData = $post;
|
||||
unset($postData['sign']);
|
||||
ksort($postData);
|
||||
$md5str = "";
|
||||
foreach ($postData as $key => $val) {
|
||||
$md5str = $md5str . $key . "=" . $val . "&";
|
||||
}
|
||||
$sign = md5($md5str . "key=" . $Md5key);
|
||||
|
||||
if ($sign != $post['sign']) {
|
||||
$update['status'] = 1;
|
||||
$update['remake'] = '签名不对,交易暂停';
|
||||
Db::name('order_record')->where('id',$order['id'])->update($update);
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 4;
|
||||
$order_log['pay_channel_name'] = 'tingPay';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,但是签名不对,回调内容:".$serializeData;
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('success');//签名不对,回调失败
|
||||
}
|
||||
|
||||
//返回金额
|
||||
if(round($post['amount'],2) != $order['money']){
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 4;
|
||||
$order_log['pay_channel_name'] = 'tingPay';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,但是金额不对,回调内容:".$serializeData;
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('success');//金额不对,回调失败
|
||||
}
|
||||
|
||||
//总代理金额
|
||||
$zdlIdArr = explode(',',$user['agent_parent_id_path']);
|
||||
$zdlId = $zdlIdArr[0];
|
||||
$zdl = Db::name('user')->where(array('id' => $zdlId, 'status' => 1, 'is_delete' => 0, 'agent' => 1))->find();
|
||||
if(!$zdl || $zdl['money'] < $order['money']){
|
||||
$update['status'] = 1;
|
||||
$update['remake'] = '无法找到总代理,或者总代理账号余分不足,交易暂停';
|
||||
Db::name('order_record')->where('id',$order['id'])->update($update);
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 4;
|
||||
$order_log['pay_channel_name'] = 'tingPay';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "无法找到总代理,或者总代理账号余分不足,回调内容:".$serializeData;
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('success');//找不到总代理,回调失败
|
||||
}
|
||||
|
||||
|
||||
|
||||
//更新订单表
|
||||
$call_back_data['back_money'] = $post['amount'];
|
||||
$call_back_data['back_sign'] = '';
|
||||
$call_back_data['back_time'] = time();
|
||||
|
||||
$call_back_data['status'] = 3;
|
||||
$call_back_data['agent_parent_id'] = $user['agent_parent_id'];
|
||||
$call_back_data['agent_parent_username'] = $user['agent_parent_username'];
|
||||
$call_back_data['zdl_id'] = $zdl['id'];
|
||||
$call_back_data['zdl_username'] = $zdl['username'];
|
||||
$call_back_data['zdl_money_before'] = $zdl['money'];
|
||||
$call_back_data['zdl_money_after'] = $zdl['money'] - $order['money'];
|
||||
$call_back_data['money_before'] = $user['money'];
|
||||
$call_back_data['money_after'] = $user['money'] + $order['money'];
|
||||
Db::name('order_record')->where(array('id' => $order['id']))->update($call_back_data);
|
||||
|
||||
//记录支付日志
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 4;
|
||||
$order_log['pay_channel_name'] = 'tingPay';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "回调支付成功";
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
//插入上分表并增加余分
|
||||
$recharge = array();
|
||||
$recharge['type'] = 4;
|
||||
$recharge['amount'] = $order['money'];
|
||||
$recharge['mode'] = 1;
|
||||
$recharge['agent_or_admin'] = 3;
|
||||
$recharge['controller_id'] = $zdl['id'];
|
||||
$recharge['controller_username'] = $zdl['username'];
|
||||
$recharge['controller_nickname'] = $zdl['nickname'];
|
||||
$recharge['controller_type'] = '第三方充值平台充值,扣取总代理余分';
|
||||
$recharge['controller_old_money'] = $zdl['money'];
|
||||
$recharge['controller_new_money'] = $zdl['money'] - $order['money'];
|
||||
$recharge['user_id'] = $order['user_id'];
|
||||
$recharge['user_type'] = $user['agent'];
|
||||
$recharge['user_agent_level'] = 0;
|
||||
$recharge['username_for'] = $user['username'];
|
||||
$recharge['nickname_for'] = $user['nickname'];
|
||||
$recharge['user_parent_id'] = $user['agent_parent_id'];
|
||||
$recharge['create_time'] = time();
|
||||
$recharge['old_money'] = $user['money'];
|
||||
$recharge['new_money'] = $user['money'] + $order['money'];
|
||||
$recharge['controller_system'] = 3;
|
||||
$recharge['remake'] = '第三方充值成功';
|
||||
Db::name('recharge')->insert($recharge);
|
||||
$updateZdl = array();
|
||||
$updateZdl['money'] = $zdl['money'] - $order['money'];
|
||||
$updateZdl['last_recharge_out'] = $order['money'];
|
||||
$updateZdl['last_recharge_out_time'] = time();
|
||||
$updateZdl['recharge_out_count'] = $zdl['recharge_out_count'] + 1;
|
||||
$updateZdl['recharge_out_total_amount'] = $zdl['recharge_out_total_amount'] + $order['money'];
|
||||
$updateUser = array();
|
||||
$updateUser['money'] = $user['money'] + $order['money'];
|
||||
$updateUser['last_recharge'] = $order['money'];
|
||||
$updateUser['last_recharge_time'] = time();
|
||||
$updateUser['recharge_count'] = $user['recharge_count'] + 1;
|
||||
$updateUser['recharge_total_amount'] = $user['recharge_total_amount'] + $order['money'];
|
||||
Db::name('user')->where(array('id' => $zdl['id']))->limit(1)->update($updateZdl);
|
||||
Db::name('user')->where(array('id' => $order['user_id']))->limit(1)->update($updateUser);
|
||||
exit('success');
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,314 @@
|
||||
<?php
|
||||
namespace app\onlinechip\controller\traits;
|
||||
use think\Db;
|
||||
use think\Log;
|
||||
use think\Request;
|
||||
trait yonghengPay{
|
||||
|
||||
|
||||
public function online_order(){
|
||||
$user_id = intval(Request::instance()->post('user_id'));
|
||||
$money = intval(Request::instance()->post('price'));
|
||||
$client = intval(Request::instance()->post('client'));
|
||||
$username = trim(Request::instance()->post('username'));
|
||||
$pay_type = intval(Request::instance()->post('pay_type'));
|
||||
$user = Db::name('user')->where(array('id' => $user_id, 'status' => 1, 'is_delete' => 0, 'agent' => 0))->find();
|
||||
$zdlIdArr = explode(',',$user['agent_parent_id_path']);
|
||||
$area_list = config('area_list');
|
||||
//判断是否金流支线,如果不是的话,不允许充值
|
||||
$isAllow = false;
|
||||
foreach($area_list[$user['area_id']]['limit_agent'] as $allowAgentId){
|
||||
if(in_array($allowAgentId,$zdlIdArr)){
|
||||
$isAllow = true;
|
||||
}
|
||||
}
|
||||
if(!$isAllow){
|
||||
return json(array('status' => 0, 'message' => '该账号暂不支持在线充值'));
|
||||
}
|
||||
$zdlId = $zdlIdArr[0];
|
||||
$zdl = Db::name('user')->where(array('id' => $zdlId, 'status' => 1, 'is_delete' => 0, 'agent' => 1))->find();
|
||||
if(!$zdl){
|
||||
return json(array('status' => 0, 'message' => '所属代理账号异常,暂不能充值'));
|
||||
}
|
||||
if($zdl['money'] < $money){
|
||||
return json(array('status' => 0, 'message' => '所属代理余额不足,暂不能充值'));
|
||||
}
|
||||
$pay_list = config('pay_list');
|
||||
if($user && $user_id > 0 && $money > 0 && $client > 0){
|
||||
$pay_memberid = "11319"; //商户ID
|
||||
$pay_orderid = 'E'.date("YmdHis").rand(100000,999999); //订单号
|
||||
$pay_amount = $money; //交易金额
|
||||
$pay_applydate = date("Y-m-d H:i:s"); //订单时间
|
||||
$pay_notifyurl = $pay_list['yongheng']['notify_url']; //服务端返回地址
|
||||
$pay_callbackurl = $pay_list['yongheng']['callback_url']; //页面跳转返回地址
|
||||
$Md5key = "yfhjiq5rkdmx4xh3egt0f4hkay574wal"; //密钥
|
||||
$tjurl = "https://www.aa168zf.com/Pay_Index.html"; //提交地址
|
||||
$pay_bankcode = $pay_type; //银行编码
|
||||
$native = array(
|
||||
"pay_memberid" => $pay_memberid,
|
||||
"pay_orderid" => $pay_orderid,
|
||||
"pay_amount" => $pay_amount,
|
||||
"pay_applydate" => $pay_applydate,
|
||||
"pay_bankcode" => $pay_bankcode,
|
||||
"pay_notifyurl" => $pay_notifyurl,
|
||||
"pay_callbackurl" => $pay_callbackurl,
|
||||
);
|
||||
ksort($native);
|
||||
$md5str = "";
|
||||
foreach ($native as $key => $val) {
|
||||
$md5str = $md5str . $key . "=" . $val . "&";
|
||||
}
|
||||
//echo($md5str . "key=" . $Md5key);
|
||||
$sign = strtoupper(md5($md5str . "key=" . $Md5key));
|
||||
$native["pay_md5sign"] = $sign;
|
||||
$native['pay_attach'] = "1234|456";
|
||||
$native['pay_productname'] = 'VIP基础服务';
|
||||
$native['format'] = 'json';
|
||||
$postdata = http_build_query($native);
|
||||
$options = array(
|
||||
'http' => array(
|
||||
'method' => 'POST',
|
||||
'header' => 'Content-type:application/x-www-form-urlencoded',
|
||||
'content' => $postdata,
|
||||
'timeout' => 15 * 60 // 超时时间(单位:s)
|
||||
)
|
||||
);
|
||||
$context = stream_context_create($options);
|
||||
$result = file_get_contents($tjurl, false, $context);
|
||||
$returnArray = json_decode($result,true);
|
||||
//echo "<pre>";
|
||||
//print_r($returnArray);
|
||||
//echo "</pre>";
|
||||
//exit();
|
||||
$data = $returnArray['data'];
|
||||
if($returnArray['status'] == 'ok'){
|
||||
$order_record = array();
|
||||
$order_record['pay_channel_id'] = 1;
|
||||
$order_record['pay_channel_name'] = '永恒168';
|
||||
$order_record['user_id'] = $user_id;
|
||||
$order_record['order_sn'] = $data['orderid'];
|
||||
$order_record['appid'] = $pay_memberid;
|
||||
$order_record['api_key'] = $Md5key;
|
||||
$order_record['money'] = $pay_amount;
|
||||
$order_record['sign'] = $sign;
|
||||
$order_record['create_time'] = time();
|
||||
$order_record['back_order_sn'] = $data['transaction_id'];
|
||||
$order_record['client'] = $client;
|
||||
$order_id = Db::name('order_record')->insertGetId($order_record);
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 1;
|
||||
$order_log['pay_channel_name'] = '永恒168';
|
||||
$order_log['money'] = $pay_amount;
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = 'user_id:'.$user_id.',用户名:'.$username.',发起充值:'.$pay_amount.',充值时间:'.date('Y-m-d H:i:s',time());
|
||||
$order_log['order_id'] = $order_id;
|
||||
$order_log['client'] = $client;
|
||||
Db::name('order_log')->insert($order_log);
|
||||
return json(array('status' => 1, 'message' => '发起支付成功,即将跳转...', 'url' => $returnArray['data']['pay_url']));
|
||||
}else{
|
||||
return json(array('status' => 0, 'message' => $returnArray['msg']));
|
||||
}
|
||||
}else{
|
||||
return json(array('status' => 0, 'message' => '支付发起失败,请稍后再试'));
|
||||
}
|
||||
}
|
||||
public function call_back_url(){
|
||||
Log::record(Request::instance()->post(),'callback');
|
||||
exit();
|
||||
}
|
||||
public function call_back(){
|
||||
$post = Request::instance()->post();
|
||||
$serializePost = json_encode($post);
|
||||
Log::record(Request::instance()->post(),'callback');
|
||||
$update = array();
|
||||
$memberid = Request::instance()->post("memberid"); // 商户ID
|
||||
$orderid = Request::instance()->post("orderid"); // 订单号
|
||||
$amount = Request::instance()->post("amount"); // 交易金额
|
||||
$datetime = Request::instance()->post("datetime"); // 交易时间
|
||||
$transaction_id = Request::instance()->post("transaction_id"); // 支付流水号
|
||||
$returncode = Request::instance()->post("returncode"); // 支付成功代码
|
||||
$callBackSign = Request::instance()->post("sign"); // 返回签名
|
||||
$returnArray = array(
|
||||
"memberid" => $memberid,
|
||||
"orderid" => $orderid,
|
||||
"amount" => $amount,
|
||||
"datetime" => $datetime,
|
||||
"transaction_id" => $transaction_id,
|
||||
"returncode" => $returncode,
|
||||
);
|
||||
$md5key = "yfhjiq5rkdmx4xh3egt0f4hkay574wal";
|
||||
ksort($returnArray);
|
||||
reset($returnArray);
|
||||
$md5str = "";
|
||||
foreach ($returnArray as $key => $val) {
|
||||
$md5str = $md5str . $key . "=" . $val . "&";
|
||||
}
|
||||
$sign = strtoupper(md5($md5str . "key=" . $md5key));
|
||||
$order = Db::name('order_record')->where('order_sn',$returnArray['orderid'])->find();
|
||||
if(!$order){
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 1;
|
||||
$order_log['pay_channel_name'] = '永恒168';
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,但是查询不到订单号,回调内容:".$serializePost;
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('OK');//订单不存在,回调失败
|
||||
}
|
||||
$user = Db::name('user')->where(array('id' => $order['user_id'], 'status' => 1, 'is_delete' => 0, 'agent' => 0))->find();
|
||||
if(!$user){
|
||||
$update['status'] = 1;
|
||||
$update['remake'] = '收到回调,无法查询到会员';
|
||||
Db::name('order_record')->where('id',$order['id'])->update($update);
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 1;
|
||||
$order_log['pay_channel_name'] = '永恒168';
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,但是查询不到会员信息,会员可能已经删除或者停用,回调内容:".$serializePost;
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('OK');//用户不存在,回调失败
|
||||
}
|
||||
if($order['status'] == 3){
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 1;
|
||||
$order_log['pay_channel_name'] = '永恒168';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,但订单已经支付完成".$serializePost;
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('OK');//用户订单已经支付完成
|
||||
}
|
||||
//签名
|
||||
if ($sign != $callBackSign) {
|
||||
$update['status'] = 1;
|
||||
$update['remake'] = '签名不对,交易暂停';
|
||||
Db::name('order_record')->where('id',$order['id'])->update($update);
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 1;
|
||||
$order_log['pay_channel_name'] = '永恒168';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,但是签名不对,回调内容:".$serializePost;
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('OK');//签名不对,回调失败
|
||||
}
|
||||
//状态
|
||||
if ($returncode != "00") {
|
||||
$update['status'] = 1;
|
||||
$update['remake'] = '支付不成功'.$returncode;
|
||||
Db::name('order_record')->where('id',$order['id'])->update($update);
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 1;
|
||||
$order_log['pay_channel_name'] = '永恒168';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,支付不成功,回调内容:".$serializePost;
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('OK');//支付状态不对,回调失败
|
||||
}
|
||||
//返回金额
|
||||
if($amount != $order['money']){
|
||||
$update['status'] = 1;
|
||||
$update['remake'] = '支付金额小于订单金额,交易停止';
|
||||
Db::name('order_record')->where('id',$order['id'])->update($update);
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 1;
|
||||
$order_log['pay_channel_name'] = '永恒168';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "收到回调,但是金额不对,回调内容:".$serializePost;
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('OK');//金额不对,回调失败
|
||||
}
|
||||
//总代理金额
|
||||
$zdlIdArr = explode(',',$user['agent_parent_id_path']);
|
||||
$zdlId = $zdlIdArr[0];
|
||||
$zdl = Db::name('user')->where(array('id' => $zdlId, 'status' => 1, 'is_delete' => 0, 'agent' => 1))->find();
|
||||
if(!$zdl || $zdl['money'] < $order['money']){
|
||||
$update['status'] = 1;
|
||||
$update['remake'] = '无法找到总代理,或者总代理账号余分不足,交易暂停';
|
||||
Db::name('order_record')->where('id',$order['id'])->update($update);
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 1;
|
||||
$order_log['pay_channel_name'] = '永恒168';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "无法找到总代理,或者总代理账号余分不足,回调内容:".$serializePost;
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
exit('OK');//找不到总代理,回调失败
|
||||
}
|
||||
|
||||
$call_back_data = array();
|
||||
//更新订单表
|
||||
$call_back_data['back_money'] = $amount;
|
||||
$call_back_data['back_sign'] = $callBackSign;
|
||||
$call_back_data['back_time'] = time();
|
||||
|
||||
$call_back_data['status'] = 3;
|
||||
$call_back_data['agent_parent_id'] = $user['agent_parent_id'];
|
||||
$call_back_data['agent_parent_username'] = $user['agent_parent_username'];
|
||||
$call_back_data['zdl_id'] = $zdl['id'];
|
||||
$call_back_data['zdl_username'] = $zdl['username'];
|
||||
$call_back_data['zdl_money_before'] = $zdl['money'];
|
||||
$call_back_data['zdl_money_after'] = $zdl['money'] - $order['money'];
|
||||
$call_back_data['money_before'] = $user['money'];
|
||||
$call_back_data['money_after'] = $user['money'] + $order['money'];
|
||||
Db::name('order_record')->where(array('id' => $order['id']))->update($call_back_data);
|
||||
|
||||
//记录支付日志
|
||||
$order_log = array();
|
||||
$order_log['pay_channel_id'] = 1;
|
||||
$order_log['pay_channel_name'] = '永恒168';
|
||||
$order_log['money'] = $order['money'];
|
||||
$order_log['create_time'] = time();
|
||||
$order_log['remake'] = "回调支付成功";
|
||||
$order_log['order_id'] = $order['id'];
|
||||
Db::name('order_log')->insert($order_log);
|
||||
//插入上分表并增加余分
|
||||
$recharge = array();
|
||||
$recharge['type'] = 4;
|
||||
$recharge['amount'] = $order['money'];
|
||||
$recharge['mode'] = 1;
|
||||
$recharge['agent_or_admin'] = 3;
|
||||
$recharge['controller_id'] = $zdl['id'];
|
||||
$recharge['controller_username'] = $zdl['username'];
|
||||
$recharge['controller_nickname'] = $zdl['nickname'];
|
||||
$recharge['controller_type'] = '第三方充值平台充值,扣取总代理余分';
|
||||
$recharge['controller_old_money'] = $zdl['money'];
|
||||
$recharge['controller_new_money'] = $zdl['money'] - $order['money'];
|
||||
$recharge['user_id'] = $order['user_id'];
|
||||
$recharge['user_type'] = $user['agent'];
|
||||
$recharge['user_agent_level'] = 0;
|
||||
$recharge['username_for'] = $user['username'];
|
||||
$recharge['nickname_for'] = $user['nickname'];
|
||||
$recharge['user_parent_id'] = $user['agent_parent_id'];
|
||||
$recharge['create_time'] = time();
|
||||
$recharge['old_money'] = $user['money'];
|
||||
$recharge['new_money'] = $user['money'] + $order['money'];
|
||||
$recharge['controller_system'] = 3;
|
||||
$recharge['remake'] = '第三方充值成功';
|
||||
Db::name('recharge')->insert($recharge);
|
||||
$updateZdl = array();
|
||||
$updateZdl['money'] = $zdl['money'] - $order['money'];
|
||||
$updateZdl['last_recharge_out'] = $order['money'];
|
||||
$updateZdl['last_recharge_out_time'] = time();
|
||||
$updateZdl['recharge_out_count'] = $zdl['recharge_out_count'] + 1;
|
||||
$updateZdl['recharge_out_total_amount'] = $zdl['recharge_out_total_amount'] + $order['money'];
|
||||
$updateUser = array();
|
||||
$updateUser['money'] = $user['money'] + $order['money'];
|
||||
$updateUser['last_recharge'] = $order['money'];
|
||||
$updateUser['last_recharge_time'] = time();
|
||||
$updateUser['recharge_count'] = $user['recharge_count'] + 1;
|
||||
$updateUser['recharge_total_amount'] = $user['recharge_total_amount'] + $order['money'];
|
||||
Db::name('user')->where(array('id' => $zdl['id']))->limit(1)->update($updateZdl);
|
||||
Db::name('user')->where(array('id' => $order['user_id']))->limit(1)->update($updateUser);
|
||||
exit('OK');
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
<html><head><title>400 Bad Request</title></head>
|
||||
<body>
|
||||
<center><h1>400 Bad Request</h1></center>
|
||||
<hr><center>nginx/1.16.1</center>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,195 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>入口</title>
|
||||
<style type="text/css">
|
||||
*{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
body{
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
min-width:1024px;
|
||||
min-height: 600px;
|
||||
background: url({$Think.ONLINE_CHIP_STATIC_DOMAIN}static/onlinechip/img/new_bg.jpg) center bottom no-repeat #030203;
|
||||
-webkit-background-size: cover;
|
||||
background-size: cover;
|
||||
}
|
||||
.title{
|
||||
position:absolute;
|
||||
font-size: 2.8vw;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
left: 4vw;
|
||||
top: 0;
|
||||
}
|
||||
/*.title:after{
|
||||
content: "";
|
||||
position: absolute;
|
||||
bottom: -0.8vw;
|
||||
left: 0;
|
||||
width:3vw;
|
||||
border-bottom: 0.4vw solid #fff;
|
||||
}*/
|
||||
.item{
|
||||
width:19vw;
|
||||
height: 25.8vw;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
margin-left: -9.5vw;
|
||||
margin-top: -13vw;
|
||||
z-index: 1;
|
||||
-webkit-transform: scale(0.9);
|
||||
-moz-transform: scale(0.9);
|
||||
-o-transform: scale(0.9);
|
||||
transform: scale(0.9);
|
||||
-webkit-transition:all 0.5s;
|
||||
-moz-transition:all 0.5s;
|
||||
-o-transition:all 0.5s;
|
||||
transition:all 0.5s;
|
||||
cursor: pointer;
|
||||
overflow: hidden;
|
||||
background-color: #2a2522;
|
||||
background-image: linear-gradient(180deg, #2a2522 0%, #292522 79%, #000 100%);
|
||||
-webkit-box-shadow:0 3px 13px 0px #545454;
|
||||
-moz-box-shadow:0 3px 13px 0px #545454;
|
||||
box-shadow: 0 3px 13px 0px #545454;
|
||||
|
||||
}
|
||||
.item img{
|
||||
width:100%;
|
||||
}
|
||||
.item.left{
|
||||
margin-left: -28vw;
|
||||
}
|
||||
.item.center{
|
||||
z-index: 2;
|
||||
}
|
||||
.item.right{
|
||||
margin-left: 9vw;
|
||||
}
|
||||
.item.hover{
|
||||
-webkit-transform: scale(1.1);
|
||||
-moz-transform: scale(1.1);
|
||||
-o-transform: scale(1.1);
|
||||
transform: scale(1.1);
|
||||
border: 2px solid #f7f120;
|
||||
z-index: 99;
|
||||
}
|
||||
.item .btn{
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
border-radius: 100px;
|
||||
position: absolute;
|
||||
font-size: 1.2vw;
|
||||
width:12vw;
|
||||
left:50%;
|
||||
bottom: 1.2vw;
|
||||
margin-left: -6vw;
|
||||
padding:0.3vw 0;
|
||||
background-color: #4d4e4b;
|
||||
background-image: linear-gradient(180deg, #4d4e4b 0%, #171312 50%, #14100f 100%);
|
||||
border: 1px solid #4d4e4b;
|
||||
}
|
||||
.item.hover .btn{
|
||||
background-color: #f7ee99;
|
||||
background-image: linear-gradient(180deg, #f7ee99 0%, #78681c 50%, #c0b141 100%);
|
||||
-webkit-transition:all 0.5s;
|
||||
-moz-transition:all 0.5s;
|
||||
-o-transition:all 0.5s;
|
||||
transition:all 0.5s;
|
||||
}
|
||||
.item.hover .btn:hover{
|
||||
background-color: #f7ee99;
|
||||
background-image: linear-gradient(180deg, #ffed48 0%, #78681c 50%, #ffed48 100%);
|
||||
}
|
||||
.item.hover .btn:active{
|
||||
opacity: 0.5;
|
||||
}
|
||||
.language{
|
||||
position: absolute;
|
||||
right: 2vw;
|
||||
top: 2vw;
|
||||
color: #fff;
|
||||
font-size: 1.2vw;
|
||||
}
|
||||
.language .icon-box{
|
||||
text-align: right;
|
||||
}
|
||||
.language .icon-box span{
|
||||
display: inline-block;
|
||||
width:30px;
|
||||
height: 22px;
|
||||
margin:5px 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.language .icon-box span:hover{
|
||||
-webkit-box-shadow:0 0px 2px 0px #f7f120;
|
||||
-moz-box-shadow:0 0px 2px 0px #f7f120;
|
||||
box-shadow: 0 0px 2px 0px #f7f120;
|
||||
}
|
||||
.language .icon-box .en{
|
||||
background: url({$Think.ONLINE_CHIP_STATIC_DOMAIN}static/onlinechip/img/lan_en.jpg) no-repeat;
|
||||
-webkit-background-size: 100%;
|
||||
background-size: 100%;
|
||||
}
|
||||
.language .icon-box .cn{
|
||||
background: url({$Think.ONLINE_CHIP_STATIC_DOMAIN}static/onlinechip/img/lan_chs.jpg) no-repeat;
|
||||
-webkit-background-size: 100%;
|
||||
background-size: 100%;
|
||||
}
|
||||
.language .icon-box .cht{
|
||||
background: url({$Think.ONLINE_CHIP_STATIC_DOMAIN}static/onlinechip/img/lan_cht.jpg) no-repeat;
|
||||
-webkit-background-size: 100%;
|
||||
background-size: 100%;
|
||||
}
|
||||
.qrcode{
|
||||
position: absolute;
|
||||
right: 2vw;
|
||||
bottom: 3vw;
|
||||
width:11vw;
|
||||
max-width: 190px;
|
||||
}
|
||||
</style>
|
||||
<script src="{$Think.ONLINE_CHIP_STATIC_DOMAIN}static/onlinechip/js/jquery-2.1.0.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="title" style="top:20px;">
|
||||
<img src="{$Think.LOGO_PATH}" />
|
||||
</div>
|
||||
<div class="item center hover" onclick="onlinechip()" style="left:32%;">
|
||||
<img src="{$Think.ONLINE_CHIP_STATIC_DOMAIN}static/onlinechip/img/netthrow.jpg">
|
||||
<span class="btn">{:lang('onlinechip_entrance')}</span>
|
||||
</div>
|
||||
<div class="item right" onclick="agentUrl()">
|
||||
<img src="{$Think.ONLINE_CHIP_STATIC_DOMAIN}static/onlinechip/img/agent.jpg">
|
||||
<span class="btn">{:lang('agent_entrance')}</span>
|
||||
</div>
|
||||
<img class="qrcode" src="{$Think.QRCODE_PATH}">
|
||||
</body>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$(".item").hover(function(){
|
||||
$(this).addClass("hover").siblings().removeClass("hover")
|
||||
},function(){
|
||||
$(this).removeClass("hover")
|
||||
$('.item.center').addClass("hover")
|
||||
})
|
||||
})
|
||||
function onlinechip(){
|
||||
window.location.href = "{$Think.ONLINE_CHIP}";
|
||||
}
|
||||
function agentUrl(){
|
||||
window.location.href = "{:url('agent/login/index')}";
|
||||
}
|
||||
</script>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,696 @@
|
||||
<!doctype html>
|
||||
<html class="no-js" lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="description" content="">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<style type="text/css">
|
||||
*{padding: 0;margin: 0;}
|
||||
.section{
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background: url(/static/onlinechip/app_img/bg.jpg) no-repeat;
|
||||
-webkit-background-size: 100%;
|
||||
background-size: 100%;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.section .box{
|
||||
position: absolute;
|
||||
width:94vw;
|
||||
height: 98vh;
|
||||
background:url(/static/onlinechip/app_img/box_bg.png)no-repeat;
|
||||
-webkit-background-size: 100% 100%;
|
||||
background-size: 100% 100%;
|
||||
left:50%;
|
||||
top: 50%;
|
||||
margin-left: -47vw;
|
||||
margin-top: -45vh;
|
||||
}
|
||||
.section .box .nav{
|
||||
position: absolute;
|
||||
width:40vw;
|
||||
top: -3vh;
|
||||
left:50%;
|
||||
margin-left: -20vw;
|
||||
border-radius: 100px;
|
||||
overflow: hidden;
|
||||
background: rgba(0,0,0,0.7);
|
||||
}
|
||||
.section .box .nav .item{
|
||||
width:33.33%;
|
||||
float: left;
|
||||
text-align: center;
|
||||
color: #5c5c5c;
|
||||
font-weight: bold;
|
||||
padding:1.4vh 0;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
|
||||
}
|
||||
.section .box .nav .item.active{
|
||||
color: #191402;
|
||||
}
|
||||
.section .box .nav .item.active:after{
|
||||
content: "";
|
||||
position: absolute;
|
||||
left:-3px;
|
||||
top: 0;
|
||||
width:106%;
|
||||
height: 100%;
|
||||
z-index: -1;
|
||||
background-color: #9f8b47;
|
||||
background-image: linear-gradient(180deg, #9f8b47 0%, #f7e9bb 50%, #9c8842 100%);
|
||||
transform: skewX(-25deg);
|
||||
}
|
||||
.section .box .tip{
|
||||
margin-left: 10vw;
|
||||
padding-left: 3vw;
|
||||
color: #646464;
|
||||
margin-top: 12.5vh;
|
||||
font-size: 12px;
|
||||
background: url(/static/onlinechip/app_img/tip_icon.png) left center no-repeat;
|
||||
-webkit-background-size: 2.2vw;
|
||||
background-size: 2.2vw;
|
||||
}
|
||||
.section .box .usermoney{
|
||||
color: #f0d78c;
|
||||
width:40%;
|
||||
margin: 3vh auto;
|
||||
margin-top: 5vh;
|
||||
text-align: center;
|
||||
background: url(/static/onlinechip/app_img/money_bg.png) no-repeat;
|
||||
-webkit-background-size: 100% 100%;
|
||||
background-size: 100% 100%;
|
||||
font-size: 3vw;
|
||||
}
|
||||
.section .box .list{
|
||||
display: table;
|
||||
width:50%;
|
||||
margin: 2vh auto;
|
||||
position: relative;
|
||||
}
|
||||
.section .withdrawal{
|
||||
display: none;
|
||||
}
|
||||
.section .withdrawal .list{
|
||||
width: 60%;
|
||||
}
|
||||
|
||||
.section .box .list .lab{
|
||||
width: 80px;
|
||||
background-image: -webkit-linear-gradient(bottom,#9c8843,#efe0b1,#9a8542);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
display: table-cell;
|
||||
font-size: 16px;
|
||||
font-weight:bold;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.section .withdrawal .list .lab{
|
||||
width: 120px;
|
||||
}
|
||||
.section .input-box{
|
||||
display: table-cell;
|
||||
width:100%;
|
||||
background: #000;
|
||||
appearance: none;
|
||||
-moz-appearance: none;
|
||||
-webkit-appearance: none;
|
||||
outline: none;
|
||||
border: 1px solid #3e3f45;
|
||||
font-size: 16px;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-weight: 500;
|
||||
border-radius: 100px;
|
||||
padding: 1.2vh 0;
|
||||
}
|
||||
.section select.input-box{
|
||||
text-align-last: center;
|
||||
background-color: #9f8b47;
|
||||
background-image: linear-gradient(180deg, #9f8b47 0%, #f7e9bb 50%, #9c8842 100%);
|
||||
color: #000;
|
||||
border-radius: 5px;
|
||||
|
||||
}
|
||||
.section .box .list .icon{
|
||||
position: absolute;
|
||||
position: absolute;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-top: 8px solid transparent;
|
||||
border-bottom: 8px solid transparent;
|
||||
border-right: 10px solid #000;
|
||||
right: 12px;
|
||||
top: 50%;
|
||||
margin-top: -8px;
|
||||
}
|
||||
.section .btn{
|
||||
border: none;
|
||||
text-decoration: none;
|
||||
outline: none;
|
||||
background-color: #9f8b47;
|
||||
background-image: linear-gradient(180deg, #9f8b47 0%, #f7e9bb 50%, #9c8842 100%);
|
||||
display:block;
|
||||
margin: 0 auto;
|
||||
font-size: 18px;
|
||||
width:100px;
|
||||
font-weight: bold;
|
||||
padding:1vh 0;
|
||||
margin-top: 6vh;
|
||||
}
|
||||
.section .btn:active{
|
||||
opacity: 0.8;
|
||||
}
|
||||
.section .unline .label{
|
||||
color: #fff;
|
||||
}
|
||||
.section .unline .label p{
|
||||
position: relative;
|
||||
display: block;
|
||||
font-size: 16px;
|
||||
width:80px;
|
||||
padding-left: 25px;
|
||||
margin: 4vh 0;
|
||||
}
|
||||
.section .unline{
|
||||
width:60%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.section .unline .table{
|
||||
display: table;
|
||||
width:100%;
|
||||
}
|
||||
.section .unline .view{
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.section .unline .label p input{
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width:20px;
|
||||
height: 20px;
|
||||
}
|
||||
.section .unline{
|
||||
font-size: 12px;
|
||||
color: #f0d78c;
|
||||
}
|
||||
.section .unline .right{
|
||||
display: none;
|
||||
}
|
||||
.section .unline .item {
|
||||
font-size: 14px;
|
||||
color: #fff;
|
||||
|
||||
}
|
||||
.section .unline .item p{
|
||||
color: #fff;
|
||||
background: rgba(0,0,0,0.8);
|
||||
padding:1vh;
|
||||
}
|
||||
.section .unline .input-box{
|
||||
border-radius: 5px;
|
||||
font-size: 12px;
|
||||
margin: 1vh 0;
|
||||
}
|
||||
.section .unline .ft{
|
||||
display: table;
|
||||
width:100%;
|
||||
font-size: 14px;
|
||||
background: rgba(0,0,0,0.8);
|
||||
padding:0 1vw;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid #3e3f45;
|
||||
border-radius: 5px;
|
||||
margin-top: 1vh;
|
||||
padding-right: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.section .unline .ft .btn-small{
|
||||
border: none;
|
||||
text-decoration: none;
|
||||
outline: none;
|
||||
background-color: #9f8b47;
|
||||
background-image: linear-gradient(180deg, #9f8b47 0%, #f7e9bb 50%, #9c8842 100%);
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
padding:1.2vh 1vw;
|
||||
float: right;
|
||||
}
|
||||
.section .unline .ft .btn-small:active{
|
||||
opacity: 0.8;
|
||||
}
|
||||
.section .unline .ft input{
|
||||
font-size: 16px;
|
||||
appearance: none;
|
||||
-moz-appearance: none;
|
||||
-webkit-appearance: none;
|
||||
outline: none;
|
||||
border: none;
|
||||
background: none;
|
||||
color: #fff;
|
||||
padding:1.2vh 0;
|
||||
}
|
||||
.section .ewm-box{
|
||||
text-align: center;
|
||||
}
|
||||
.section .unline .imgewm{
|
||||
width:30vh;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.section .unline .textewm{
|
||||
width:10px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
padding-right: 1vw;
|
||||
}
|
||||
.section .choseCard{
|
||||
width:70%;
|
||||
margin: 2vh auto;
|
||||
position: relative;
|
||||
display: none;
|
||||
}
|
||||
.section .choseCard .btn_addCard{
|
||||
color: #f0d78c;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
font-size: 12px;
|
||||
}
|
||||
.section .btn_backCard{
|
||||
color: #f0d78c;
|
||||
position: absolute;
|
||||
right: 15%;
|
||||
bottom: 15vh;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body oncontextmenu="return false;">
|
||||
<div class="section">
|
||||
<div class="box">
|
||||
<div class="nav">
|
||||
<span class="item active">在线充值</span>
|
||||
<span class="item ">离线充值</span>
|
||||
<span class="item ">资金提现</span>
|
||||
</div>
|
||||
<div class="tip">提示:请选择支付方式,然后输入您要的充值的余额,并确认充值。</div>
|
||||
<div class="usermoney">{$user_info.money}</div>
|
||||
<div class="online" style="display: block">
|
||||
<div class="list">
|
||||
<label class="lab">会员账号:</label>
|
||||
<input class="input-box" disabled="" type="text" value="{$user_info.username}" name="">
|
||||
</div>
|
||||
<div class="list">
|
||||
<label class="lab">支付方式:</label>
|
||||
<i class="icon"></i>
|
||||
<select class="input-box" name="pay_type" id="pay_type">
|
||||
<option value ="3">微信支付</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="list">
|
||||
<label class="lab">充值金额:</label>
|
||||
<input placeholder="请输入充值金额" class="input-box" type="text" name="price" id="price">
|
||||
</div>
|
||||
<button class="btn" id="confirm">确定充值</button>
|
||||
</div>
|
||||
<div class="unline " style="display: none">
|
||||
<div class="table">
|
||||
<div class="view label">
|
||||
{if condition="($rechargeinfo.bank_info != 0)"}
|
||||
<p><input name="paytype" type="radio" checked="checked" id="bankpay" value="1" name=""><label for="bankpay">银行卡支付</label></p>
|
||||
{/if}
|
||||
{if condition="($rechargeinfo.weixin_info != 0)"}
|
||||
<p><input name="paytype" type="radio" id="wxpay" value="2" name=""><label for="wxpay">微信支付</label></p>
|
||||
{/if}
|
||||
{if condition="($rechargeinfo.alipay_info != 0)"}
|
||||
<p><input name="paytype" type="radio" id="alipay" value="3" name=""><label for="alipay">支付宝支付</label></p>
|
||||
{/if}
|
||||
</div>
|
||||
{if condition="($rechargeinfo.bank_info != 0)"}
|
||||
<div class="view right bankpay" style="display: block">
|
||||
<div class="v-box">
|
||||
<!-- <div class="title">官方收款账号:</div> -->
|
||||
<div class="item">
|
||||
<i class="icon"></i>
|
||||
<p id="recharge_bank_name">{$rechargeinfo.bank_info.0.receivables_bank}</p>
|
||||
<select class="input-box" id="recharge_bank_num" onchange="changeSelect1()">
|
||||
{foreach name="$rechargeinfo.bank_info" item="vo"}
|
||||
<option value ={$vo.value_num}>{$vo.receivables_bank_number}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
<!-- <div class="title">打款账号:</div> -->
|
||||
<input class="input-box" placeholder="请填写银行名称" type="text" name="recharge_bank" id="recharge_bank">
|
||||
<input class="input-box" placeholder="请填写银行卡号" type="text" name="recharge_cardnumber" id="recharge_cardnumber">
|
||||
<input type="hidden" name="bank_receivables_id" id="bank_receivables_id" value="{$rechargeinfo.bank_info.0.id}" />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if condition="($rechargeinfo.weixin_info != 0)"}
|
||||
<div class="view ewm-box wxpay right">
|
||||
<div class="textewm">扫码充值</div>
|
||||
<img class="imgewm" src="{$rechargeinfo.weixin_info.receivables_qr_code}">
|
||||
<input type="hidden" name="wx_receivables_id" id="wx_receivables_id" value="{$rechargeinfo.weixin_info.id}" />
|
||||
</div>
|
||||
{/if}
|
||||
{if condition="($rechargeinfo.alipay_info != 0)"}
|
||||
<div class="view ewm-box alipay right">
|
||||
<div class="textewm">扫码充值</div>
|
||||
<img class="imgewm" src="{$rechargeinfo.alipay_info.receivables_qr_code}">
|
||||
<input type="hidden" name="al_receivables_id" id="al_receivables_id" value="{$rechargeinfo.alipay_info.id}" />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="ft">
|
||||
{if condition="($rechargeinfo.alipay_info != 0 && $rechargeinfo.weixin_info != 0 && $rechargeinfo.bank_info != 0)"}
|
||||
充值金额:<input type="text" placeholder="请输入" name="recharge_money" id="recharge_money"> <button class="btn-small" id="offline_confirm">确认充值</button>
|
||||
{else}
|
||||
<div style="background:none;border:none;text-align: center;font-size: 24px;">暂不支持离线充值</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<div class="withdrawal">
|
||||
<div class="addCard" id="addCard">
|
||||
{if condition="($show_withdrawal != 0)"}
|
||||
<div class="btn_backCard" id="btn_backCard" onclick="backChose()">返回选择<font style="font-family:'黑体'"> 》</font></div>
|
||||
{/if}
|
||||
<div class="list">
|
||||
<label class="lab">提现金额: </label>
|
||||
<input class="input-box" placeholder="请输入提款金额" type="text" name="withdrawal_money" id="withdrawal_money">
|
||||
</div>
|
||||
<div class="list">
|
||||
<label class="lab">开户银行名称: </label>
|
||||
<input class="input-box" placeholder="请输入所属银行名称" type="text" name="withdrawal_bank" id="withdrawal_bank">
|
||||
</div>
|
||||
<div class="list">
|
||||
<label class="lab">开户银行支行: </label>
|
||||
<input class="input-box" placeholder="请填写开户银行地址" type="text" name="withdrawal_bank_branch" id="withdrawal_bank_branch">
|
||||
</div>
|
||||
<div class="list">
|
||||
<label class="lab">开户姓名: </label>
|
||||
<input class="input-box" placeholder="请填写开户姓名" type="text" name="withdrawal_name" id="withdrawal_name">
|
||||
</div>
|
||||
<div class="list">
|
||||
<label class="lab">银行卡号: </label>
|
||||
<input class="input-box" placeholder="请填写卡号" type="text" name="withdrawal_cardnumber" id="withdrawal_cardnumber">
|
||||
</div>
|
||||
<button class="btn" id="withdrawal">确定申请</button>
|
||||
</div>
|
||||
<div class="choseCard" id="choseCard">
|
||||
<div class="btn_addCard" onclick="swithCard()">使用新银行卡<font style="font-family:'黑体'"> 》</font></div>
|
||||
<div class="list" style="margin-top:5vh">
|
||||
<label class="lab">请选择银行卡: </label>
|
||||
|
||||
<select class="input-box" id="bank_num" onchange="changeSelect()" style="padding-left:1vw;">
|
||||
{foreach name="$show_withdrawal" item="vo"}
|
||||
<option value ={$vo.value_num}>{$vo.receivables_bank_number}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
<input type="hidden" name="chose_bank_number" id="chose_bank_number" value="{$show_withdrawal.0.receivables_bank_number}" />
|
||||
</div>
|
||||
<div class="list">
|
||||
<label class="lab">开户银行名称: </label>
|
||||
<input class="input-box" readonly name="choseCard_name" id="choseCard_name" value="{$show_withdrawal.0.receivables_bank}">
|
||||
</div>
|
||||
<input type="hidden" name="chose_bank_branch" id="chose_bank_branch" value="{$show_withdrawal.0.receivables_bank_branch}" />
|
||||
<input type="hidden" name="chose_name" id="chose_name" value="{$show_withdrawal.0.receivables_name}" />
|
||||
|
||||
<div class="list" >
|
||||
<label class="lab">提现金额: </label>
|
||||
<input class="input-box" placeholder="请输入提款金额" value='' name="recharge_money2" id="recharge_money2">
|
||||
</div>
|
||||
<button class="btn" style="margin-top:5vh" id="withdrawal2">确定申请</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="user_id" id="user_id" value="{$user_info.id}" />
|
||||
<input type="hidden" name="client" id="client" value="{$client}" />
|
||||
<input type="hidden" name="username" id="username" value="{$user_info.username}" />
|
||||
</body>
|
||||
<script type="text/javascript" src="/static/onlinechip/js/jquery-2.1.0.min.js"></script>
|
||||
<script type="text/javascript" src="/static/onlinechip/layer/layer.js"></script>
|
||||
<script type="text/javascript">
|
||||
function changeSelect(){
|
||||
choseCardIndex = document.getElementById('bank_num').value;
|
||||
bankcard = {$json_withdrawal};
|
||||
document.getElementById('chose_bank_number').value=bankcard[choseCardIndex].receivables_bank_number;
|
||||
document.getElementById('choseCard_name').value=bankcard[choseCardIndex].receivables_bank;
|
||||
document.getElementById('chose_bank_branch').value=bankcard[choseCardIndex].receivables_bank_branch;
|
||||
document.getElementById('chose_name').value=bankcard[choseCardIndex].receivables_name;
|
||||
}
|
||||
function changeSelect1(){
|
||||
choseCardIndex = document.getElementById('recharge_bank_num').value;
|
||||
bankcard = {$json_banke_info};
|
||||
$('#recharge_bank_name').html(bankcard[choseCardIndex].receivables_bank);
|
||||
$('#bank_receivables_id').val(bankcard[choseCardIndex].id);
|
||||
}
|
||||
function swithCard(){
|
||||
document.getElementById('choseCard').style.display="none";
|
||||
document.getElementById('addCard').style.display="block";
|
||||
document.getElementById('btn_backCard').style.display="block";
|
||||
|
||||
}
|
||||
function backChose(){
|
||||
document.getElementById('choseCard').style.display="block";
|
||||
document.getElementById('addCard').style.display="none";
|
||||
}
|
||||
$(function(){
|
||||
$(".nav .item").click(function(){
|
||||
var index=$(this).index();
|
||||
$(this).addClass("active").siblings().removeClass("active");
|
||||
if(index==0){
|
||||
$(".unline").css("display","none");
|
||||
$(".online").css("display","block");
|
||||
$(".withdrawal").css("display","none");
|
||||
}else if(index==1){
|
||||
$(".online").css("display","none");
|
||||
$(".unline").css("display","block");
|
||||
$(".withdrawal").css("display","none");
|
||||
}else if(index==2){
|
||||
$(".online").css("display","none");
|
||||
$(".unline").css("display","none");
|
||||
$(".withdrawal").css("display","block");
|
||||
}
|
||||
|
||||
})
|
||||
$("input[name='paytype']").change(function(){
|
||||
var type=$(this).val();
|
||||
$(".section .unline .right").css("display","none")
|
||||
if(type==1){
|
||||
$(".section .unline .bankpay").css("display","block")
|
||||
}else if(type==2){
|
||||
$(".section .unline .wxpay").css("display","block")
|
||||
}else if(type==3){
|
||||
$(".section .unline .alipay").css("display","block")
|
||||
}
|
||||
})
|
||||
$('#confirm').click(function (){
|
||||
var iswap = "{$iswap}";
|
||||
var price = parseInt($('#price').val());
|
||||
var user_id = parseInt($('#user_id').val());
|
||||
var client = parseInt($('#client').val());
|
||||
var username = $('#username').val();
|
||||
var pay_type = $('#pay_type').val();
|
||||
if(user_id > 0 && client > 0){
|
||||
if(price > 0){
|
||||
var query = new Object();
|
||||
query.user_id = user_id;
|
||||
query.client = client;
|
||||
query.price = price;
|
||||
query.username = username;
|
||||
if(pay_type == 1){
|
||||
url = '/order/online_order';
|
||||
}else if(pay_type == 2){
|
||||
url = '/order/union_pay';
|
||||
}else if(pay_type == 3){
|
||||
url = '/order/weixin_pay';
|
||||
}
|
||||
$.ajax({
|
||||
url:url,
|
||||
type:"POST",
|
||||
dataType:"JSON",
|
||||
data:query,
|
||||
async:false,
|
||||
success:function(data){
|
||||
if(data.status == 1){
|
||||
if(iswap == 1){
|
||||
window.open(data.url);
|
||||
}else{
|
||||
window.parent.postMessage({
|
||||
data:data.url
|
||||
},'*');
|
||||
}
|
||||
//window.open(data.url);
|
||||
//window.location.href=data.url;
|
||||
$('#price').val('');
|
||||
}else{
|
||||
layer.msg(data.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
}else{
|
||||
layer.msg('请正确输入充值金额,充值金额必须大于100');
|
||||
}
|
||||
}else{
|
||||
layer.msg('充值出错,请稍后再试');
|
||||
}
|
||||
})
|
||||
|
||||
$('#offline_confirm').click(function (){
|
||||
var query = new Object();
|
||||
query.recharge_type = $(':radio[name="paytype"]:checked').val();
|
||||
query.user_id = parseInt($('#user_id').val());
|
||||
query.recharge_money = parseInt($('#recharge_money').val());
|
||||
if(query.recharge_type == 1){
|
||||
query.receivables_id = parseInt($('#bank_receivables_id').val());
|
||||
query.recharge_bank = parseInt($('#recharge_bank').val());
|
||||
query.recharge_cardnumber = parseInt($('#recharge_cardnumber').val());
|
||||
if(!query.recharge_bank){
|
||||
layer.msg('银行名称不能为空');
|
||||
return false;
|
||||
}
|
||||
if(!query.recharge_cardnumber){
|
||||
layer.msg('银行卡号不能为空');
|
||||
return false;
|
||||
}
|
||||
|
||||
}else if(query.recharge_type == 2){
|
||||
query.receivables_id = parseInt($('#wx_receivables_id').val());
|
||||
}else{
|
||||
query.receivables_id = parseInt($('#al_receivables_id').val());
|
||||
};
|
||||
if(query.user_id > 0){
|
||||
if(query.recharge_money > 0){
|
||||
$.ajax({
|
||||
url:'/order/recharge',
|
||||
type:"POST",
|
||||
dataType:"JSON",
|
||||
data:query,
|
||||
async:false,
|
||||
success:function(data){
|
||||
layer.msg(data.Data.msg);
|
||||
if(data.Success == 1){
|
||||
$('#recharge_bank').val('');
|
||||
$('#recharge_cardnumber').val('');
|
||||
$('#recharge_money').val('');
|
||||
}
|
||||
}
|
||||
})
|
||||
}else{
|
||||
layer.msg('请正确输入充值金额');
|
||||
}
|
||||
}else{
|
||||
layer.msg('充值出错,请稍后再试');
|
||||
}
|
||||
})
|
||||
//提现
|
||||
$('#withdrawal').click(function (){
|
||||
var query = new Object();
|
||||
query.user_id = parseInt($('#user_id').val());
|
||||
query.recharge_money = parseInt($('#withdrawal_money').val());
|
||||
query.recharge_name = $('#withdrawal_name').val();
|
||||
query.recharge_bank = $('#withdrawal_bank').val();
|
||||
query.recharge_bank_branch = $('#chose_bank_branch').val();
|
||||
query.recharge_cardnumber = $('#withdrawal_cardnumber').val();
|
||||
if(!query.recharge_bank){
|
||||
layer.msg('提款银行不能为空');
|
||||
return false;
|
||||
}
|
||||
if(!query.recharge_bank_branch){
|
||||
layer.msg('提款银行支行不能为空');
|
||||
return false;
|
||||
}
|
||||
if(!query.recharge_name){
|
||||
layer.msg('持卡人不能为空');
|
||||
return false;
|
||||
}
|
||||
if(!query.recharge_cardnumber){
|
||||
layer.msg('提款银行卡号不能为空');
|
||||
return false;
|
||||
}
|
||||
if(query.user_id > 0){
|
||||
if(query.recharge_money > 0){
|
||||
$.ajax({
|
||||
url:'/order/withdrawal',
|
||||
type:"POST",
|
||||
dataType:"JSON",
|
||||
data:query,
|
||||
async:false,
|
||||
success:function(data){
|
||||
layer.msg(data.Data.msg);
|
||||
if(data.Success == 1){
|
||||
$('.usermoney').html(data.Data.newMoney);
|
||||
$('#withdrawal_money').val('');
|
||||
$('#withdrawal_bank').val('');
|
||||
$('#withdrawal_bank_branch').val('');
|
||||
$('#withdrawal_name').val('');
|
||||
$('#withdrawal_cardnumber').val('');
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}else{
|
||||
layer.msg('请正确输入提现金额');
|
||||
}
|
||||
}else{
|
||||
layer.msg('提现出错,请稍后再试');
|
||||
}
|
||||
})
|
||||
//提现
|
||||
$('#withdrawal2').click(function (){
|
||||
var query = new Object();
|
||||
query.user_id = parseInt($('#user_id').val());
|
||||
query.recharge_money = parseInt($('#recharge_money2').val());
|
||||
query.recharge_name = $('#chose_name').val();
|
||||
query.recharge_bank = $('#choseCard_name').val();
|
||||
query.recharge_bank_branch = $('#chose_bank_branch').val();
|
||||
query.recharge_cardnumber = $('#chose_bank_number').val();
|
||||
if(!query.recharge_bank){
|
||||
layer.msg('提款银行不能为空');
|
||||
return false;
|
||||
}
|
||||
if(!query.recharge_bank_branch){
|
||||
layer.msg('提款银行支行不能为空');
|
||||
return false;
|
||||
}
|
||||
if(!query.recharge_name){
|
||||
layer.msg('持卡人不能为空');
|
||||
return false;
|
||||
}
|
||||
if(!query.recharge_cardnumber){
|
||||
layer.msg('提款银行卡号不能为空');
|
||||
return false;
|
||||
}
|
||||
if(query.user_id > 0){
|
||||
if(query.recharge_money > 0){
|
||||
$.ajax({
|
||||
url:'/order/withdrawal',
|
||||
type:"POST",
|
||||
dataType:"JSON",
|
||||
data:query,
|
||||
async:false,
|
||||
success:function(data){
|
||||
layer.msg(data.Data.msg);
|
||||
if(data.Success == 1){
|
||||
$('.usermoney').html(data.Data.newMoney);
|
||||
$('#recharge_money2').val('');
|
||||
}
|
||||
}
|
||||
})
|
||||
}else{
|
||||
layer.msg('请正确输入提现金额');
|
||||
}
|
||||
}else{
|
||||
layer.msg('提现出错,请稍后再试');
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
<?=$content ?>
|
||||
@@ -0,0 +1,41 @@
|
||||
<!doctype html>
|
||||
<html class="no-js" lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="description" content="">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
|
||||
|
||||
</head>
|
||||
<style>
|
||||
#content-main{
|
||||
width: 700px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
margin-top: 100px;
|
||||
border: 1px solid #1a1919;
|
||||
}
|
||||
.content-row{
|
||||
margin: 10px;
|
||||
border-bottom: 1px solid #8b8b8b;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div id="content-main">
|
||||
<span class="content-row">超商代碼快速取號</span>
|
||||
<span class="content-row">超商代碼:【<?=$StoreCode ?>】</span>
|
||||
<span class="content-row">繳費金額:【<?=$Total ?>】</span>
|
||||
<span class="content-row">行動條碼:【<a href="<?=$mobileUrl?>" target="_blank">點此進入行動條碼繳費界面(另開視窗)】</a></span>
|
||||
<span class="content-row">注意事項:
|
||||
<p>
|
||||
超商代碼重複列印繳費,將會造成系統異常。
|
||||
</p>
|
||||
<p>
|
||||
為了您的權益,請勿重複繳費。
|
||||
</p>
|
||||
</span>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,256 @@
|
||||
<!doctype html>
|
||||
<html class="no-js" lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="description" content="">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<style type="text/css">
|
||||
*{padding: 0;margin: 0;}
|
||||
.box{
|
||||
display: table;
|
||||
width:100%;
|
||||
height: 80vh;
|
||||
}
|
||||
.box .card-box{
|
||||
display: table-cell;
|
||||
width: 50%;
|
||||
height: 80vh;
|
||||
}
|
||||
.box .card-box .card{
|
||||
width:94%;
|
||||
margin: 11vh auto;
|
||||
height: 58vh;
|
||||
background: url(/static/onlinechip/pay_img/card_bg.png) no-repeat;
|
||||
-webkit-background-size: 100% 100%;
|
||||
background-size: 100% 100%;
|
||||
position: relative;
|
||||
}
|
||||
.box .card-box .card .lab{
|
||||
font-size: 2.1vw;
|
||||
position: absolute;
|
||||
left:3vw;
|
||||
top: 3vw;
|
||||
padding-left: 3.8vw;
|
||||
line-height: 3.8vw;
|
||||
background: url(/static/onlinechip/pay_img/icon_money.png) no-repeat;
|
||||
-webkit-background-size: 3vw;
|
||||
background-size: 3vw;
|
||||
}
|
||||
.box .card-box .card .name{
|
||||
font-size: 2.1vw;
|
||||
position: absolute;
|
||||
right:0.8vw;
|
||||
top: 3vw;
|
||||
color: #fff;
|
||||
padding:0 1vw;
|
||||
line-height: 3.8vw;
|
||||
background: url(/static/onlinechip/pay_img/name_bg.png) no-repeat;
|
||||
-webkit-background-size: 100% 100%;
|
||||
background-size: 100% 100%;
|
||||
text-shadow:0px 0px 1px #9e8861;
|
||||
}
|
||||
.box .card-box .card .money{
|
||||
font-size: 4.2vw;
|
||||
font-weight: bold;
|
||||
text-shadow:1px 1px 2px #aa823c;
|
||||
color: #fff;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
margin-top: -5vw;
|
||||
width:100%;
|
||||
text-align: center;
|
||||
}
|
||||
.box .card-box .card .ft{
|
||||
display: table;
|
||||
width:100%;
|
||||
position: absolute;
|
||||
bottom: 5vw;
|
||||
left: 0;
|
||||
font-size: 1.9vw;
|
||||
}
|
||||
|
||||
.box .card-box .card .ft .item{
|
||||
display: table-cell;
|
||||
width:50%;
|
||||
/*padding-left: 2vw;*/
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
}
|
||||
.box .card-box .card .ft .text{
|
||||
font-size: 2.1vw;
|
||||
}
|
||||
.box .card-box .card .ft .num{
|
||||
color: #fff;
|
||||
padding-top: 0.4vw;
|
||||
display: block;
|
||||
}
|
||||
.box .input-box{
|
||||
display: table-cell;
|
||||
width: 50%;
|
||||
height: 80vh;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.box .input-box .item{
|
||||
font-size: 2.1vw;
|
||||
display: table;
|
||||
width:100%;
|
||||
margin-bottom: 3vw;
|
||||
position: relative;
|
||||
}
|
||||
.box .input-box .item .lab{
|
||||
display: table-cell;
|
||||
width:15vw;
|
||||
text-align: right;
|
||||
min-width: 85px;
|
||||
color: #fff;
|
||||
}
|
||||
.box .input-box .item .input{
|
||||
display: table-cell;
|
||||
width:90%;
|
||||
text-align: center;
|
||||
background: #1a1509;
|
||||
border: 1px solid #88867f;
|
||||
outline:none;
|
||||
color: #e9dbaf;
|
||||
font-size: 2.1vw;
|
||||
border-radius: 100px;
|
||||
line-height: 5vw;
|
||||
height: 5vw;
|
||||
appearance:none;
|
||||
-moz-appearance:none;
|
||||
-webkit-appearance:none;
|
||||
text-align-last:center;
|
||||
}
|
||||
.box .input-box .item select.input{
|
||||
color: #1a150a;
|
||||
background: background-color: #c7b26c;
|
||||
background-image: linear-gradient(180deg, #c7b26c 0%, #f7e9ba 50%, #bba452 100%);
|
||||
|
||||
}
|
||||
.box .input-box .item input:focus{
|
||||
box-shadow:1px 1px 10px #c7bb05;
|
||||
}
|
||||
.box .input-box .item .icon{
|
||||
position: absolute;
|
||||
right:11%;
|
||||
top: 50%;
|
||||
margin-top: -0.46vw;
|
||||
border-width: 1vw;
|
||||
border-style: solid;
|
||||
border-color:#1a150a transparent transparent transparent;
|
||||
border-top-width: 1.5vw;
|
||||
}
|
||||
.btn-recharge{
|
||||
width:40vw;
|
||||
height: 12vh;
|
||||
line-height: 12vh;
|
||||
background: url("/static/onlinechip/pay_img/btn_bg.png");
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
-webkit-background-size: 100% 100%;
|
||||
background-size: 100% 100%;
|
||||
margin:4vh auto;
|
||||
cursor: pointer;
|
||||
color: #fff;
|
||||
font-size: 2.5vw;
|
||||
}
|
||||
option{
|
||||
text-align:center;
|
||||
}
|
||||
.btn-recharge:active{
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body oncontextmenu="return false;">
|
||||
<div class="box">
|
||||
<div class="card-box">
|
||||
<div class="card">
|
||||
<div class="lab">余额 (元)</div>
|
||||
<div class="name">{$user_info.username}</div>
|
||||
<div class="money">{$user_info.money}</div>
|
||||
<div class="ft">
|
||||
<div class="item">
|
||||
|
||||
<p class="text">在线充值</p>
|
||||
<!--<p class="num">1000.00</p>-->
|
||||
|
||||
</div>
|
||||
<div class="item">
|
||||
<p class="text">方便快捷</p>
|
||||
<!--<p class="num">1000.00</p>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-box">
|
||||
<div class="item">
|
||||
<label class="lab">充值金额:</label>
|
||||
<input class="input" onkeyup="value=value.replace(/[^\d]/g,'')" maxlength="6" placeholder="请输入金额" type="text" name="price" id="price" autocomplete="off">
|
||||
</div>
|
||||
<?php if(!empty($payMethod)): ?>
|
||||
<div class="item">
|
||||
<label class="lab">选择付款方式:</label>
|
||||
<i class="icon"></i>
|
||||
<select class="input" name="pay_type" id="pay_type" style="color:#fff;">
|
||||
<?php foreach($payMethod as $key=>$method): ?>
|
||||
<option value ="<?=$key?>"><?=$method?></option>
|
||||
<?php endForeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<?php endIf; ?>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="user_id" id="user_id" value="{$user_info.id}" />
|
||||
<input type="hidden" name="client" id="client" value="{$client}" />
|
||||
<input type="hidden" name="username" id="username" value="{$user_info.username}" />
|
||||
<div class="btn-recharge" id="confirm">确定充值</div>
|
||||
</body>
|
||||
<script type="text/javascript" src="/static/onlinechip/js/jquery-2.1.0.min.js"></script>
|
||||
<script type="text/javascript" src="/static/onlinechip/layer-v3.1.1/layer.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function (){
|
||||
$('#confirm').click(function (){
|
||||
var price = parseInt($('#price').val());
|
||||
var user_id = parseInt($('#user_id').val());
|
||||
var client = parseInt($('#client').val());
|
||||
var username = $('#username').val();
|
||||
var pay_type = $('#pay_type').val();
|
||||
if(user_id > 0 && client > 0){
|
||||
if(price > 0){
|
||||
var query = new Object();
|
||||
query.user_id = user_id;
|
||||
query.client = client;
|
||||
query.price = price;
|
||||
query.username = username;
|
||||
query.pay_type = pay_type;
|
||||
url = '/order/<?=$online_order_fac ?>';
|
||||
$.ajax({
|
||||
url:url,
|
||||
type:"POST",
|
||||
dataType:"JSON",
|
||||
data:query,
|
||||
async:false,
|
||||
success:function(data){
|
||||
if(data.status == 1){
|
||||
window.open(data.url);
|
||||
//window.location.href=data.url;
|
||||
}else{
|
||||
layer.msg(data.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
}else{
|
||||
layer.msg('请正确输入充值金额,充值金额必须大于100');
|
||||
}
|
||||
}else{
|
||||
layer.msg('充值出错,请稍后再试');
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</html>
|
||||
@@ -0,0 +1,36 @@
|
||||
<!doctype html>
|
||||
<html class="no-js" lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="description" content="">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
|
||||
</head>
|
||||
<body oncontextmenu="return false;">
|
||||
</body>
|
||||
<script type="text/javascript" src="/static/onlinechip/js/jquery-2.1.0.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function (){
|
||||
var query = new Object();
|
||||
query.memberid = '11319';
|
||||
query.orderid = 'E20191218222607483742';
|
||||
query.transaction_id = '20191218222609491019u7u9';
|
||||
query.amount = '1.0000';
|
||||
query.datetime = '20191218223534';
|
||||
query.returncode = '00';
|
||||
query.sign = '60F9446B29174DD6DF0A0E62B068A3B2';
|
||||
query.attach = '1234|456';
|
||||
url = '/order/call_back';
|
||||
$.ajax({
|
||||
url:url,
|
||||
type:"POST",
|
||||
dataType:"JSON",
|
||||
data:query,
|
||||
async:false,
|
||||
success:function(data){
|
||||
console.log(data);
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
<form id="payForm" method="post" action="http://pay.xingfpay.com:9341/gateway/pay">
|
||||
<input type="hidden" name="trade_amount" id="trade_amount" value="{$trade_amount}">
|
||||
<input type="hidden" name="service_type" value="e_bank">
|
||||
<input type="hidden" name="mer_no" id="mer_no" value="{$mer_no}">
|
||||
<input type="hidden" name="mer_order_no" id="mer_order_no" value="{$mer_order_no}">
|
||||
<input type="hidden" name="order_date" id="order_date" value="{$order_date}">
|
||||
<input type="hidden" name="page_url" id="page_url" value="{$page_url}">
|
||||
<input type="hidden" name="back_url" id="back_url" value="{$back_url}">
|
||||
<input type="hidden" name="channel_code" value="ABC">
|
||||
<input type="hidden" name="sign" id="sign" value="{$sign}">
|
||||
<input type="hidden" name="sign_type" value="MD5">
|
||||
</form>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
document.getElementById('payForm').submit();
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,265 @@
|
||||
<!doctype html>
|
||||
<html class="no-js" lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="description" content="">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<base target="_blank" />
|
||||
<style type="text/css">
|
||||
*{padding: 0;margin: 0;}
|
||||
body{
|
||||
background: #000;
|
||||
}
|
||||
.card-box{
|
||||
background: url(/static/onlinechip/pay_img/bg.jpg);
|
||||
width: 100%;
|
||||
height: 240px;
|
||||
-webkit-background-size: 100% 100%;
|
||||
background-size: 100% 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.card-box .card{
|
||||
width:300px;
|
||||
height: 180px;
|
||||
margin: 30px auto;
|
||||
background: url(/static/onlinechip/pay_img/card_bg.png);
|
||||
-webkit-background-size: 100% 100%;
|
||||
background-size: 100% 100%;
|
||||
position: relative;
|
||||
}
|
||||
.card-box .card .lab{
|
||||
position: absolute;
|
||||
left: 20px;
|
||||
top: 10px;
|
||||
font-size: 16px;
|
||||
padding-left: 22px;
|
||||
background: url(/static/onlinechip/pay_img/icon_money.png) left 0 no-repeat;
|
||||
-webkit-background-size: 18px;
|
||||
background-size: 18px;
|
||||
}
|
||||
.card-box .card .username{
|
||||
position: absolute;
|
||||
right: 4px;
|
||||
top: 0px;
|
||||
padding:5px;
|
||||
background: url(/static/onlinechip/pay_img/name_bg.png) no-repeat;
|
||||
-webkit-background-size: 100% 100%;
|
||||
background-size: 100% 100%;
|
||||
color: #fff;
|
||||
border-top-right-radius: 18px;
|
||||
}
|
||||
.card-box .card .money{
|
||||
text-align: center;
|
||||
font-size: 28px;
|
||||
width:90%;
|
||||
margin: 0 auto;
|
||||
padding-top: 50px;
|
||||
}
|
||||
.card-box .card .ft{
|
||||
position: absolute;
|
||||
bottom: 30px;
|
||||
left: 0;
|
||||
width:100%;
|
||||
display: table;
|
||||
font-size: 14px;
|
||||
text-align:center;
|
||||
}
|
||||
.card-box .card .ft .item{
|
||||
width:50%;
|
||||
display: table-cell;
|
||||
/*padding-left: 20px;*/
|
||||
color:#fff;
|
||||
}
|
||||
.input-money{
|
||||
width:85%;
|
||||
margin: 20px auto;
|
||||
display: table;
|
||||
}
|
||||
.input-money .lab{
|
||||
display: table-cell;
|
||||
color: #fff;
|
||||
vertical-align: middle;
|
||||
width:90px;
|
||||
font-size: 18px;
|
||||
}
|
||||
.input-money input{
|
||||
display: table-cell;
|
||||
width:100%;
|
||||
vertical-align: middle;
|
||||
background: #1a1509;
|
||||
border: 1px solid #88867f;
|
||||
outline: none;
|
||||
color: #e9dbaf;
|
||||
padding:7px 20px;
|
||||
font-size: 16px;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
border-radius: 100px;
|
||||
|
||||
}
|
||||
.input-money input::-webkit-input-placeholder {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
.input-money input:focus{
|
||||
box-shadow:1px 1px 10px #c7bb05;
|
||||
}
|
||||
.select-box{
|
||||
width:85%;
|
||||
margin: 0 auto;
|
||||
position: relative;
|
||||
}
|
||||
.select-box .lab{
|
||||
color: #fff;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
.select-box .select{
|
||||
background: #dfdfdf;
|
||||
appearance: none;
|
||||
-moz-appearance: none;
|
||||
-webkit-appearance: none;
|
||||
text-align-last: center;
|
||||
outline: none;
|
||||
width:100%;
|
||||
border-radius: 0;
|
||||
line-height: 35px;
|
||||
font-size: 18px;
|
||||
color: #666563;
|
||||
}
|
||||
.select-box .icon{
|
||||
position: absolute;
|
||||
width:0;
|
||||
height:0;
|
||||
border-top:12px solid transparent;
|
||||
border-bottom:12px solid transparent;
|
||||
border-right:14px solid #555555;
|
||||
right: 10px;
|
||||
bottom: 6.5px;
|
||||
}
|
||||
.btn{
|
||||
width:85%;
|
||||
height: 38px;
|
||||
font-size: 18px;
|
||||
border-radius: 8px;
|
||||
margin: 0 auto;
|
||||
display: block;
|
||||
outline: none;
|
||||
appearance: none;
|
||||
-moz-appearance: none;
|
||||
-webkit-appearance: none;
|
||||
border: none;
|
||||
background-color: #ddbb4b;
|
||||
background-image: linear-gradient(180deg, #ddbb4b 0%, #f6e9bc 50%, #907f44 100%);
|
||||
margin-top: 50px;
|
||||
}
|
||||
#redirect_btn{
|
||||
width:85%;
|
||||
height: 38px;
|
||||
font-size: 18px;
|
||||
border-radius: 8px;
|
||||
margin: 0 auto;
|
||||
display: block;
|
||||
outline: none;
|
||||
appearance: none;
|
||||
-moz-appearance: none;
|
||||
-webkit-appearance: none;
|
||||
border: none;
|
||||
background-color: #ddbb4b;
|
||||
margin-top: 20px;
|
||||
text-align:center;
|
||||
color:#fff;
|
||||
line-height:38px;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body oncontextmenu="return false;">
|
||||
<div class="card-box">
|
||||
<div class="card">
|
||||
<div class="lab">余额(元)</div>
|
||||
<div class="username">{$user_info.username}</div>
|
||||
<div class="money">{$user_info.money}</div>
|
||||
<div class="ft">
|
||||
<div class="item">
|
||||
<p class="name">在线充值</p>
|
||||
<!--<p class="num">200.00</p>-->
|
||||
</div>
|
||||
<div class="item">
|
||||
<p class="name">方便快捷</p>
|
||||
<!--<p class="num">200.00</p>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-money">
|
||||
<label class="lab">充值金额:</label>
|
||||
<input type="text" placeholder="请填写充值金额" onkeyup="value=value.replace(/[^\d]/g,'')" maxlength="6" placeholder="请输入金额" type="text" name="price" id="price" autocomplete="off">
|
||||
</div>
|
||||
<?php if(!empty($payMethod)): ?>
|
||||
<div class="select-box">
|
||||
<p class="lab">选择充值方式</p>
|
||||
<i class="icon"></i>
|
||||
<select class="select" name="pay_type" id="pay_type">
|
||||
<?php foreach($payMethod as $key=>$method): ?>
|
||||
<option value ="<?=$key?>"><?=$method?></option>
|
||||
<?php endForeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<?php endIf; ?>
|
||||
<input type="hidden" name="user_id" id="user_id" value="{$user_info.id}" />
|
||||
<input type="hidden" name="client" id="client" value="{$client}" />
|
||||
<input type="hidden" name="username" id="username" value="{$user_info.username}" />
|
||||
<button class="btn" id="confirm">确定充值</button>
|
||||
<a id="redirect_btn" href="" style="display:none;">已经请求成功,点击这里跳转支付</a>
|
||||
</body>
|
||||
<script type="text/javascript" src="/static/onlinechip/js/jquery-2.1.0.min.js"></script>
|
||||
<script type="text/javascript" src="/static/onlinechip/layer-v3.1.1/layer.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function (){
|
||||
$('#confirm').click(function (){
|
||||
var price = parseInt($('#price').val());
|
||||
var user_id = parseInt($('#user_id').val());
|
||||
var client = parseInt($('#client').val());
|
||||
var username = $('#username').val();
|
||||
var pay_type = $('#pay_type').val();
|
||||
if(user_id > 0 && client > 0){
|
||||
if(price > 0){
|
||||
var query = new Object();
|
||||
query.user_id = user_id;
|
||||
query.client = client;
|
||||
query.price = price;
|
||||
query.username = username;
|
||||
query.pay_type = pay_type;
|
||||
url = '/order/<?=$online_order_fac ?>';
|
||||
//var winRef = window.open("","_blank");
|
||||
$.ajax({
|
||||
url:url,
|
||||
type:"POST",
|
||||
dataType:"JSON",
|
||||
data:query,
|
||||
async:false,
|
||||
success:function(data){
|
||||
if(data.status == 1){
|
||||
//winRef.location = data.url;
|
||||
//window.open(data.url);
|
||||
$('#confirm').hide();
|
||||
$('#redirect_btn').attr('href',data.url);
|
||||
$('#redirect_btn').show();
|
||||
}else{
|
||||
layer.msg(data.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
}else{
|
||||
layer.msg('请正确输入充值金额,充值金额必须大于100');
|
||||
}
|
||||
}else{
|
||||
layer.msg('充值出错,请稍后再试');
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</html>
|
||||
Reference in New Issue
Block a user