検索
ホームページphp教程php手册php json增加积分函数

php json增加积分函数

Jun 13, 2016 am 10:50 AM
functionhtmljsonphp関数判断増加積分サイバーカフェ

[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;
 }
    }
 
}


 

作者:chaojie2009
声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

AI Hentai Generator

AI Hentai Generator

AIヘンタイを無料で生成します。

ホットツール

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

強力な PHP 統合開発環境

AtomエディタMac版ダウンロード

AtomエディタMac版ダウンロード

最も人気のあるオープンソースエディター

ドリームウィーバー CS6

ドリームウィーバー CS6

ビジュアル Web 開発ツール

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

このプロジェクトは osdn.net/projects/mingw に移行中です。引き続きそこでフォローしていただけます。 MinGW: GNU Compiler Collection (GCC) のネイティブ Windows ポートであり、ネイティブ Windows アプリケーションを構築するための自由に配布可能なインポート ライブラリとヘッダー ファイルであり、C99 機能をサポートする MSVC ランタイムの拡張機能が含まれています。すべての MinGW ソフトウェアは 64 ビット Windows プラットフォームで実行できます。

MantisBT

MantisBT

Mantis は、製品の欠陥追跡を支援するために設計された、導入が簡単な Web ベースの欠陥追跡ツールです。 PHP、MySQL、Web サーバーが必要です。デモおよびホスティング サービスをチェックしてください。