phpjson增加积分函数_PHP教程
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了phpjson增加积分函数_PHP教程,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2421字,纯文字阅读大概需要4分钟。
内容图文
![phpjson增加积分函数_PHP教程](/upload/InfoBanner/zyjiaocheng/175/37a010988bad4cf9af7a678084260769.jpg)
function zeng_integral(){
$jifen=& m('integral');
/*判断网吧*/
$store=isset($store_id)?intval($store_id):0;
$injifen=$jifen->get(array('user_id'=>$_SESSION['user_info']['user_id']));
$yanzhen=json_decode($injifen['integrallog'],true);
if(isset($injifen)){
$arrstore=array();
foreach ($yanzhen as $k=>$v){
$arrstore[]=$v['store_id'];
}
/*判断网吧积分是否存在如果存*/
if (in_array($store,$arrstore)) {
foreach ($yanzhen as $key=>$val){
$yanzhen[$key]['store_id']=$key;
$yanzhen[$key]['jifen']=$val['jifen']+5;
}
$integral=json_encode($yanzhen);
}else {
foreach ($yanzhen as $key=>$val){
$yanzhen[$store]['store_id']=$store;
$yanzhen[$store]['jifen']=1;
}
$integral=json_encode($yanzhen);
}
/*构造数据*/
$data=array(
'integrallog'=>$integral,
);
$integ=$jifen->edit($injifen['id'],$data);
if ($integ) {
return true;
}
}else {
/*构造数组*/
$config=array();
$config[$store]['store_id']=$store;
$config[$store]['jifen']=1;
$integral=json_encode($config);
/*构造数据*/
$data=array(
'user_id'=>$_SESSION['user_info']['user_id'],
'integrallog'=>$integral,
);
$integ=$jifen->add($data);
if ($integ) {
return true;
}
}
}
function zeng_integral(){
$jifen=& m('integral');
/*判断网吧*/
$store=isset($store_id)?intval($store_id):0;
$injifen=$jifen->get(array('user_id'=>$_SESSION['user_info']['user_id']));
$yanzhen=json_decode($injifen['integrallog'],true);
if(isset($injifen)){
$arrstore=array();
foreach ($yanzhen as $k=>$v){
$arrstore[]=$v['store_id'];
}
/*判断网吧积分是否存在如果存*/
if (in_array($store,$arrstore)) {
foreach ($yanzhen as $key=>$val){
$yanzhen[$key]['store_id']=$key;
$yanzhen[$key]['jifen']=$val['jifen']+5;
}
$integral=json_encode($yanzhen);
}else {
foreach ($yanzhen as $key=>$val){
$yanzhen[$store]['store_id']=$store;
$yanzhen[$store]['jifen']=1;
}
$integral=json_encode($yanzhen);
}
/*构造数据*/
$data=array(
'integrallog'=>$integral,
);
$integ=$jifen->edit($injifen['id'],$data);
if ($integ) {
return true;
} www.2cto.com
}else {
/*构造数组*/
$config=array();
$config[$store]['store_id']=$store;
$config[$store]['jifen']=1;
$integral=json_encode($config);
/*构造数据*/
$data=array(
'user_id'=>$_SESSION['user_info']['user_id'],
'integrallog'=>$integral,
);
$integ=$jifen->add($data);
if ($integ) {
return true;
}
}
}
http://www.bkjia.com/PHPjc/478155.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/478155.htmlTechArticle[html] function zeng_integral(){ $jifen= m(integral); /*判断网吧*/ $store=isset($store_id)?intval($store_id):0; $injifen=$jifen-get(array(user_id=$_SESSION[user_info][user_id])...
内容总结
以上是互联网集市为您收集整理的phpjson增加积分函数_PHP教程全部内容,希望文章能够帮你解决phpjson增加积分函数_PHP教程所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。