1,获取推广员设置的游戏cp比例

2,增加update_pay_config($account, $type='wx')   更新支付发起配置
3,增加update_paycallback_config($orderid, $type='wx')  更新支付回调配置
master
tping 5 years ago
parent cc6a22a4f5
commit 42dcfe6f4d

@ -1085,6 +1085,10 @@ function is_check_account($account){
$promoteId = intval($promoteId); $promoteId = intval($promoteId);
$gameId = intval($gameId); $gameId = intval($gameId);
$promote = M('promote', 'tab_')->find($promoteId); $promote = M('promote', 'tab_')->find($promoteId);
$gameId = M('game', 'tab_')->where(array('id' => $gameId))->getField('relation_game_id');
if (empty($gameId)) {
return false;
}
if (empty($promote)) { if (empty($promote)) {
return false; return false;
@ -1806,6 +1810,101 @@ function get_wx_type(){
} }
/**
* 根据用户account查找会长更新支付配置
* @param number $flag type 微信wx 阿里alipay 快捷shortcut
* @return number
*/
function update_pay_config($account, $type='wx') {
if (!$account) return ;
// 查看用户所属的会长
$promote = M('promote', 'tab_')->where([
'account' => $account
])->find();
if (!$promote) return ;
$chain = explode('/', $promote['chain']);
if (!$chain || !$chain[0]) return ;
$map['type'] = $type;
$map['promote_id'] = $chain[0];
$map['status'] = 1;
$payConfig = M('promote_pay_config','tab_')->where($map)->find();
if ($payConfig) {
if ($type == 'wx') {
C('wei_xin.email', $payConfig['appid']); // APP ID
C('wei_xin.partner', $payConfig['account']); // 商户号
C('wei_xin.key', $payConfig['secret']);
}
if ($type == 'alipay') {
C('alipay.appid', $payConfig['appid']);
C('alipay.pub_secret', $payConfig['pub_secret']);
C('alipay.pri_secret', $payConfig['pri_secret']);
}
if ($type == 'shortcut') {
C('sqpay.partner', $payConfig['account']);
C('sqpay.key', $payConfig['secret']);
}
}
}
/**
* 支付回调配置信息
* 根据用户订单ID查找会长更新支付配置
* @param number $flag type 微信wx 阿里alipay 快捷shortcut
* @return number
*/
function update_paycallback_config($orderid, $type='wx') {
if (!$orderid) return ;
$pay_where = substr($orderid, 0, 2);
$account = '';
if ($pay_where == 'SP') { // 游戏充值
$spend = M('spend', 'tab_')->where([
'pay_order_number' => $orderid
])->find();
$account = $spend['user_account'];
}
if ($pay_where == 'PF') { // 平台币充值
$deposit = M('deposit', 'tab_')->where([
'pay_order_number' => $orderid
])->find();
$account = $deposit['user_account'];
}
if (!$account) return ;
// 查看用户所属的会长
$promote = M('promote', 'tab_')->where([
'account' => $account
])->find();
if (!$promote) return ;
$chain = explode('/', $promote['chain']);
if (!$chain || !$chain[0]) return ;
$map['type'] = $type;
$map['promote_id'] = $chain[0];
$map['status'] = 1;
$payConfig = M('promote_pay_config','tab_')->where($map)->find();
if ($payConfig) {
if ($type == 'wx') {
C('wei_xin.email', $payConfig['appid']); // APP ID
C('wei_xin.partner', $payConfig['account']); // 商户号
C('wei_xin.key', $payConfig['secret']);
}
if ($type == 'alipay') {
C('alipay.appid', $payConfig['appid']);
C('alipay.pub_secret', $payConfig['pub_secret']);
C('alipay.pri_secret', $payConfig['pri_secret']);
}
if ($type == 'shortcut') {
C('sqpay.partner', $payConfig['account']);
C('sqpay.key', $payConfig['secret']);
}
}
}
function get_wx_pay_type($flag=0) { function get_wx_pay_type($flag=0) {
if(MODULE_NAME=='Media'||MODULE_NAME=='Media2'||MODULE_NAME=='Home'){ if(MODULE_NAME=='Media'||MODULE_NAME=='Media2'||MODULE_NAME=='Home'){
$map['name']=array('in',array('wei_xin','weixin','weixin_gf')); $map['name']=array('in',array('wei_xin','weixin','weixin_gf'));

Loading…
Cancel
Save