|
|
@ -1806,6 +1806,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'));
|
|
|
|