Пример #1
0
 public function lottery_shop_json()
 {
     if (!isset($_GET['gid'])) {
         echo json_encode(array("error" => '1'));
         return;
         exit;
     }
     $gid = trim($_GET['gid']);
     $times = (int) System::load_sys_config('system', 'goods_end_time');
     if (!$times) {
         $times = 1;
     }
     $db = System::load_sys_class('model');
     $gid = safe_replace($gid);
     $gid = str_ireplace("select", "", $gid);
     $gid = str_ireplace("union", "", $gid);
     $gid = str_ireplace("'", "", $gid);
     $gid = str_ireplace("%27", "", $gid);
     $gid = trim($gid, ',');
     if (!$gid) {
         $info = $db->GetOne("select qishu,xsjx_time,id,zongrenshu,thumb,title,q_uid,q_user,q_user_code,q_end_time,yunjiage from `@#_shoplist` where `q_showtime` = 'Y' order by `q_end_time` ASC");
     } else {
         $infos = $db->GetList("select  qishu,xsjx_time,id,zongrenshu,thumb,title,q_uid,q_user,q_user_code,q_end_time,yunjiage from `@#_shoplist` where `q_showtime` = 'Y' order by `q_end_time` ASC ");
         $gid = @explode('_', $gid);
         $info = false;
         foreach ($infos as $infov) {
             if (!in_array($infov['id'], $gid)) {
                 $info = $infov;
                 break;
             }
         }
     }
     if (!$info) {
         echo json_encode(array("error" => '1'));
         return;
         exit;
     }
     //        //time格式
     //
     //
     //	$list_geshi=explode(".",$info['q_end_time']);
     //
     //	$time_geshi = data("Y年m月d日 H:i",$info['q_end_time']);
     //        System::load_sys_fun("my");
     //$jiexiao_time = microt($info['q_end_time'],'r');
     if ($info['xsjx_time']) {
         $info['q_end_time'] = $info['q_end_time'] + $times;
     }
     System::load_sys_fun("user");
     $user = unserialize($info['q_user']);
     $user = get_user_name($info['q_uid'], "username");
     $uid = $info['q_uid'];
     $upload = G_UPLOAD_PATH;
     $q_time = substr($info['q_end_time'], 0, 10);
     $city = get_uid_ip($info['q_user_code'], 'ipcity');
     if ($q_time <= time()) {
         $db->Query("update `@#_shoplist` SET `q_showtime` = 'N' where `id` = '{$info['id']}' and `q_showtime` = 'Y' and `q_uid` is not null");
         echo json_encode(array("error" => '-1'));
         return;
         exit;
     }
     $user_touxiang = get_user_key($info['q_uid'], 'img');
     //缺中奖用户头像 来自城市 完整用户ID
     $user_shop_number = $db->GetOne("select sum(gonumber) as gonumber from `@#_member_go_record` where `uid`= '{$uid}' and `shopid` = '{$info['id']}' and `shopqishu` = '{$info['qishu']}'");
     $user_shop_number = $user_shop_number['gonumber'];
     $times = $q_time - time();
     $zhongjiangid = $uid + 1000000000;
     echo json_encode(array("error" => "0", "time_geshi" => $info['q_end_time'], "city" => "{$city}", "user_touxiang" => "{$user_touxiang}", "user_shop_number" => "{$user_shop_number}", "user" => "{$user}", "zongrenshu" => $info['zongrenshu'], "q_user_code" => $info['q_user_code'], "qishu" => $info['qishu'], "upload" => $upload, "thumb" => $info['thumb'], "id" => $info['id'], "uid" => "{$zhongjiangid}", "title" => $info['title'], "user" => $user, "times" => $times));
     exit;
 }
                            <dt><em>获得者:</em>
                            <span>
                                <a href="<?php 
        echo WEB_PATH;
        ?>
/uname/<?php 
        echo idjia($qishu['q_uid']);
        ?>
" target="_blank"><?php 
        echo get_user_name($qishu['q_user']);
        ?>
</a>
                            </span>
                            </dt>
                            <dd class="z-lott-lz">来自:<?php 
        echo get_uid_ip($qishu['q_user_code'], 'ipcity');
        ?>
</dd>
                            <dd>幸运<?php 
        echo _cfg('web_name_two');
        ?>
码:<strong class="orange Fb"><?php 
        echo $qishu['q_user_code'];
        ?>
</strong></dd>
                            <dd>本雨参与:<strong class="orange Fb"><?php 
        echo get_user_goods_num($qishu['q_uid'], $qishu['id']);
        ?>
</strong>人次</dd>							
                        </dl>    
                    </div>