[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']));
$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;
}
}
}