<?php
/*金沙江出品 客服QQ109588550 
 *近来发现很多站长朋友私自更改代码造成插件无法访问
 *所以敬告站长朋友：此页为核心代码，请勿私自修改！
 *多沟通，多提问，有问题就联系我们。
 */
if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}
	$config = $_G['cache']['plugin']['jsjpay'];
	$jflx = $_G['setting']['extcredits'][$config['jifen']]['title'];
	$jifen = $config['jifen'];
	$bili = $config['bili'];
	$uid = intval($_POST['uid']);
	$total = intval($_POST['total']);
	$addnum = addslashes($_POST['addnum']);
	$apikey = addslashes($_POST['apikey']);

	$credit = intval($total*$bili);
	$mykey	= md5($config['apikey'].$addnum.$uid.$total);
	$num = C::t('#jsjpay#jsjpay')->count_by_num($addnum);

if($apikey!=$mykey || !$addnum || !$total){
	showmessage(lang('plugin/jsjpay','n4'),'home.php?mod=spacecp&ac=plugin&op=credit&id=jsjpay:log', array(), array('alert' => 'info'));
	exit;
}else if($num <= '0'){
	$data = array();
	$data['uid'] = $uid;
	$data['op'] = '1';
	$data['addnum'] = $addnum;
	$data['total'] = $total;
	$data['time'] = intval($_G['timestamp']);
	C::t('#jsjpay#jsjpay')->insert($data);

	$msg = array('total'=>$total,'jifen'=>$credit,'jflx'=>$jflx);
	notification_add($uid, 'system', lang('plugin/jsjpay','msg'), $msg, $system = 1);
	updatemembercount($uid , array($jifen => +"$credit"), 1, 'AFD', $uid);
	showmessage(lang('plugin/jsjpay','n1'),'home.php?mod=spacecp&ac=plugin&op=credit&id=jsjpay:log', array(), array('alert' => 'right'));
}else if($num >= '1'){{
	showmessage(lang('plugin/jsjpay','n1'),'home.php?mod=spacecp&ac=plugin&op=credit&id=jsjpay:log', array(), array('alert' => 'right'));

}

?>