예제 #1
0
 function getParent()
 {
     $user = log_model::getIdUserLogin();
     foreach ($user as $id) {
     }
     $id_u = $id['ID_U'];
     $q = $this->db->select('*')->from('menu_dropdown_parent')->join('fk_user_menu_dropdown ', 'fk_user_menu_dropdown.ID_MENU = menu_dropdown_parent.ID ', 'inner')->join('qtht_users ', 'qtht_users.ID_U = fk_user_menu_dropdown.ID_U ', 'inner')->where('qtht_users.ID_U', $id_u);
     return $q->get()->result_array();
 }
예제 #2
0
 function getUrlUserAvartar()
 {
     $user_log = new log_model();
     $log = $user_log->getIdUserLogin();
     foreach ($log as $id) {
     }
     $id_avartar = $id['ID_U'];
     $q = $this->db->select('*')->from('qtht_users')->where('ID_U', $id_avartar)->get()->result_array();
     return $q;
 }
예제 #3
0
파일: cron.php 프로젝트: lughong/shop
 public function killsec_user_order_clear()
 {
     $log = new log_model();
     $redisModel = new redis_model();
     $sqlModel = new sql_model();
     $instance = new instance_model();
     $status_array = array(KILLSEC_STATUS_PREVIEW, KILLSEC_STATUS_GOING);
     $filter = array('status' => $status_array);
     $instance_list = $instance->get_instance($filter);
     foreach ($instance_list as $k => $v) {
         $total = $v['killsec_count'];
         if ($v['status'] == KILLSEC_STATUS_PREVIEW) {
             //开始前2分钟生成token
             if (strtotime($v['start_time']) - 20 * 60 <= time()) {
                 //更新实例表状态
                 $sql = "update activity_killsec_instance set status='" . KILLSEC_STATUS_GOING . "' where instance_id='{$v['instance_id']}' and status=" . KILLSEC_STATUS_PREVIEW;
                 $user_list = $sqlModel->query($sql);
                 $log->write_log('更新实例表状态sql=' . $sql);
                 $redisModel->save_token($v['activity_id'], $redisModel->create_token($v['killsec_count']));
             }
         } elseif ($v['status'] == KILLSEC_STATUS_GOING) {
             $sql = "select * from activity_killsec_user where instance_id='{$v['instance_id']}'";
             $user_list = $sqlModel->query($sql);
             $pay_count = 0;
             $order_userIds = array();
             $payment_userIds = array();
             if ($user_list && count($user_list) > 0) {
                 foreach ($user_list as $sk => $sv) {
                     if (empty($sv['order_time'])) {
                         if (time() - strtotime($sv['join_time']) - ORDER_WAIT_TIME > 0) {
                             //ORDER_WAIT_TIME后没下单
                             $order_userIds[] = $v['user_id'];
                         }
                     } elseif (empty($sv['pay_time'])) {
                         if (time() - strtotime($sv['join_time']) - PAYMENT_WAIT_TIME > 0) {
                             //PAYMENT_WAIT_TIME后没支付
                             $payment_userIds[] = $v['user_id'];
                         }
                     } elseif (!empty($sv['pay_time'])) {
                         $pay_count += 1;
                     }
                 }
             }
             $userIds = $order_userIds + $payment_userIds;
             $count = count($userIds);
             if ($count > 0) {
                 //删除过期用户
                 $sql = "delete from activity_killsec_user where user_id in(" . implode(',', $userIds) . ")";
                 $user_list = $sqlModel->query($sql);
                 $log->write_log('删除过期用户sql=' . $sql);
                 //更新参与数量
                 $sql = "update activity_killsec_instance set join_count ='" . $v['join_count'] - $count . "' where instance_id='{$v['instance_id']}'";
                 $user_list = $sqlModel->query($sql);
                 $log->write_log('更新参与数量sql=' . $sql);
                 //补充token
                 $redisModel->save_token($v['activity_id'], $redisModel->create_token($count));
             }
             if ($pay_count == $total) {
                 //秒杀完成
                 $sql = "update activity_killsec_instance set status='" . KILLSEC_STATUS_FINISH . "' where instance_id='{$v['instance_id']}' and status=" . KILLSEC_STATUS_GOING;
                 $user_list = $sqlModel->query($sql);
                 $log->write_log('秒杀完成sql=' . $sql);
             }
         }
     }
 }
예제 #4
0
 public function count_inbox()
 {
     $log = new log_model();
     $idu = $log->getIdUserLogin();
     foreach ($idu as $user) {
     }
     $idu = $user['ID_U'];
     $result = $this->db->select('COUNT(tinnhan_thongtin.id_thongtin) as C')->select('SUM(tinnhan_nhan.danhan) as UNREAD')->from('tinnhan_nhan')->join('tinnhan_thongtin', 'tinnhan_thongtin.id_thongtin=tinnhan_nhan.id_thongtin', 'inner')->where('nguoinhan', $idu)->where('tinnhan_nhan.hienthi', '1');
     $tmp = $result->get()->result();
     $res['count_inbox'] = $tmp[0]->C;
     $res['count_unread'] = $tmp[0]->UNREAD;
     return $res;
 }
예제 #5
0
 function insertFile($idObject, $isTemp, $iddiv, $year, $type, $pdf = 0, $is_nogetcontent = 0)
 {
     $date = getdate();
     if (!$type) {
         $type = -1;
     }
     $year = '2012';
     if (!$idObject) {
         $idObject = 0;
     }
     if (!$isTemp) {
         $isTemp = 0;
     }
     $model = new filedinhkem_model();
     //Lưu file đính kèm xuống thư mục tạm
     $temp_path = $model->getTempPath();
     //lấy id người đăng nhập
     $user_log = new log_model();
     $user = $user_log->getIdUserLogin();
     foreach ($user as $au) {
     }
     //lấy idmessage
     $message_model = new message_model();
     $thongtin = $message_model->getId_Thongtin();
     foreach ($thongtin as $id_thongtin) {
     }
     $id_tn = $id_thongtin['id_thongtin'] + 1;
     //lấy idfood
     $food = new admin_model();
     $max_food = $food->getMaxIdFood();
     foreach ($max_food as $food_join) {
     }
     $ID = $food_join['ID'] + 1;
     //lấy id_project
     $project = new project_model();
     $duan = $project->getMaxId();
     foreach ($duan as $file_project) {
         $id_project = $file_project['ID_PR'] + 1;
     }
     $filepath = $temp_path . DIRECTORY_SEPARATOR . $_FILES['uploadedfile']['name'];
     if (!move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $filepath)) {
         return -1;
     } else {
         $file = new FileDinhKem();
         $file->_time_update = $date['year'] . '-' . $date['mon'] . '-' . $date['mday'] . ' ' . $date['hours'] . ':' . $date['minutes'] . ':' . $date['seconds'];
         $file->_nam = $date['year'];
         $file->_thang = $date['mon'];
         $dirPath = $model->getDir($file->_nam, $file->_thang);
         $file->_id_thongtin = $id_tn;
         $file->_folder = $dirPath;
         $file->_id_object = $idObject;
         $file->_ID = $ID;
         $file->_id_project = $id_project;
         $file->_user = $au['ID_U'];
         $file->_filename = $_FILES['uploadedfile']['name'];
         $file->_mime = $_FILES['uploadedfile']['type'];
         $file->_type = $type;
         $model->insertFileObject($file);
         //get attachment id
         $id = $this->getId_Dk();
         foreach ($id as $object) {
             $id_file = $object['ID_DK'];
         }
         $maso = $id_file . $file->_filename . $file->_time_update;
         //var_dump($maso);
         $maso = md5($maso);
         $model->md5_update($id_file, $maso);
         $newlocation = $dirPath . DIRECTORY_SEPARATOR . $maso;
         rename($filepath, $newlocation);
         $file->_pathFile = $newlocation;
         $file->_id_dk = $id_file;
         return $id_file;
     }
 }