Example #1
0
function timeCoincides($t1, $t2)
{
    $s1 = intval(getStartTime($t1));
    $e1 = intval(getEndTime($t1));
    $s2 = intval(getStartTime($t2));
    $e2 = intval(getEndTime($t2));
    return $s1 <= $e2 and $e1 >= $s2;
}
session_start();
require_once "config.php";
require_once "time.php";
require_once "getters.php";
$db = loadDatabase();
$email = $_SESSION['user'];
$eventName = $_POST['eventName'];
$description = $_POST['description'];
$scheduleName = $_POST['scheduleName'];
$eventStartTime = $_POST['eventStartTime'];
$eventEndTime = $_POST['eventEndTime'];
$userId = getUserId($db, $scheduleName, $email);
$scheduleId = getScheduleId($db, $scheduleName, $userId);
$startTime = getStartTime($db, $scheduleName, $scheduleId);
$endTime = getEndTime($db, $scheduleName, $scheduleId);
$placeEvent = schedule($db, $scheduleId, $eventStartTime, $eventStartTime, $startTime, $endTime);
if ($placeEvent) {
    addToDatabase($db, $eventName, $description, $eventStartTime, $eventEndTime, $scheduleId);
}
function schedule($db, $scheduleId, $eventStartTime, $eventEndTime, $startTime, $endTime)
{
    $query = "SELECT startTime, endTime FROM scheduleEvent se JOIN event e WHERE scheduleId=:id AND eventId = e.id";
    $query = $db->prepare($query);
    $query->execute(array(':id' => $scheduleId));
    $prevScheduledEnd;
    $isFull = false;
    foreach ($query->fetchAll() as $event) {
        if (isset($prevScheduledEnd) && greaterThanOrEqualToTime($eventStartTime, $prevScheduledEnd) && greaterThanOrEqualToTime($event['startTime'], $eventEndTime)) {
            return true;
        }
    $showUnposted = false;
}
if (isset($_GET['print']) && $_GET['print'] == 1) {
    $printMode = true;
} else {
    $printMode = false;
}
try {
    $hourTypesQuery = $db->prepare("SELECT ID,value,name,color FROM scheduleHourTypes WHERE area=:area AND `deleted` = 0");
    $hourTypesQuery->execute(array(':area' => $area));
} catch (PDOException $e) {
    exit("error in query");
}
$hourTypes = array();
$startTime = getStartTime();
$endTime = getEndTime();
if (!isSchedulePosted($date)) {
    echo "<h3 align='center' style='color:red'>Schedule For Week Not Yet Posted</h3>";
}
echo "<table class='schedule' id='sched'><thead><tr><th class='schedule_time'><b>Hours</b></th>";
while ($row = $hourTypesQuery->fetch(PDO::FETCH_ASSOC)) {
    $hourTypes[] = $row['ID'];
    if (!in_array($row['ID'], $values)) {
        continue;
    }
    echo "<th class='schedule' style='background-color:" . $row['color'] . "'> <b> " . $row['name'] . "</b> </th>";
}
echo "</tr></thead><tbody>";
for ($hour = $startTime * 1; $hour <= $endTime; $hour += $hourSize) {
    echo "<tr class='schedule'><td class='schedule_time'>" . hourToTime($hour) . "</td>";
    foreach ($hourTypes as $curType) {
 public function examiney()
 {
     $id = $_POST['id'];
     $duration = $_POST['duration'];
     $homsuser = $_POST['homsuser'];
     $homspassword = $_POST['homspassword'];
     $info = $_POST['info'];
     if (empty($_POST['examiney'])) {
         $this->error('审核状态不可为空!');
     } else {
         $examiney = $_POST['examiney'];
     }
     $user_apply = M('shares_apply')->field("uid,principal")->where("id = {$id}")->find();
     $user = M('members m')->field(" m.id,m.user_email,m.user_phone,ms.email_status,ms.phone_status")->join(" lzh_members_status ms ON m.id=ms.uid ")->where(" m.id = '" . $user_apply['uid'] . "' ")->find();
     $account_money = M('member_money')->getFieldByuid($user_apply['uid'], "account_money");
     $back_money = M('member_money')->getFieldByuid($user_apply['uid'], "back_money");
     if ($account_money + $back_money < $user_apply['principal']) {
         $this->error('申请人可用余额不足!');
     }
     if ($_POST['examiney'] == 2) {
         //发送客户端账号密码
         $homsuser = M('homsuser')->where("status = 0 and uid = 0")->order("id DESC")->find();
         if ($homsuser) {
             $info = '您在手投网股票配资平台申请配资成功,您的HOMS账号为:' . $homsuser['homsuser'] . ',密码为:' . $homsuser['homspass'] . ',请妥善保管,不要泄露他人!【手投网】';
             $ret = sendsms($user['user_phone'], $info);
             if ($ret) {
                 $savedata = array();
                 $savedata['status'] = 1;
                 $savedata['uid'] = $user['id'];
                 M('homsuser')->where("id = {$homsuser['id']}")->save($savedata);
             }
         } else {
             $this->error("HOMS账号已经用完,请及时录入!");
         }
         $the_current = time();
         $date_the_current = date("Y-m-d", $the_current);
         $apply = array();
         $apply['client_user'] = $homsuser['homsuser'];
         $apply['client_pass'] = $homsuser['homspass'];
         $apply['status'] = $examiney;
         $apply['examine_time'] = $the_current;
         $apply['info'] = $info;
         // $apply['endtime'] = strtotime(date("Y-m-d",strtotime("$date_the_current + $duration day")));
         $apply['endtime'] = getEndTime($duration, $the_current);
         $ret = M('shares_apply')->where("id = {$id}")->save($apply);
         if ($ret) {
             $applyfind = M('shares_apply')->where("id = {$id}")->find();
             $vo = examinembermoney($applyfind['uid'], $applyfind['principal'], $applyfind['manage_fee'], $applyfind['order'], $applyfind['id']);
             if ($vo) {
                 alogs("examiney", 0, 1, '管理员执行了股票配资并填写homs信息操作成功!');
                 $this->success('审核成功!');
             }
         } else {
             alogs("examiney", 0, 1, '管理员执行了股票配资并填写homs信息操作失败!');
             $this->error('审核失败!');
         }
     } elseif ($_POST['examiney'] == 4) {
         $apply = array();
         $apply['status'] = $examiney;
         $apply['examine_time'] = $the_current;
         $apply['info'] = $info;
         // $apply['endtime'] = strtotime(date("Y-m-d",strtotime("$date_the_current + $duration day")));
         $apply['endtime'] = getEndTime($duration, $the_current);
         $ret = M('shares_apply')->where("id = {$id}")->save($apply);
         if ($ret) {
             $info = '很遗憾,您在手投网申请股票配资未通过,原因为' . $info . '!【手投网】';
             sendsms($user['user_phone'], $info);
             alogs("examiney", 0, 1, '管理员执行了股票配资审核不通过操作成功!');
             $this->success('审核不通过操作成功!');
         } else {
             alogs("examiney", 0, 1, '管理员执行了股票配资审核不通过操作失败!');
             $this->success('审核不通过操作失败!');
         }
     }
 }
Example #5
0
 function thisTimeslotIsAfterOther($other)
 {
     return dateAIsAfterDateB(getStartTime(), other . getEndTime());
 }
 public function examiney()
 {
     $id = $_POST['id'];
     $duration = $_POST['duration'];
     $homsuser = $_POST['homsuser'];
     $homspassword = $_POST['homspassword'];
     $info = $_POST['info'];
     if (empty($_POST['examiney'])) {
         $this->error('审核状态不可为空!');
     } else {
         $examiney = $_POST['examiney'];
     }
     if ($_POST['examiney'] == 2) {
         //发送客户端账号密码
         $homsuser = M('homsuser')->where("status = 0 and uid = 0")->order("id DESC")->find();
         if ($homsuser) {
             $info = '您在手投网股票配资平台申请配资成功,您的HOMS账号为:' . $homsuser['homsuser'] . ',密码为:' . $homsuser['homspass'] . ',请妥善保管,不要泄露他人!【手投网】';
             $ret = sendsms($user['user_phone'], $info);
             if ($ret) {
                 $savedata = array();
                 $savedata['status'] = 1;
                 $savedata['uid'] = $user['id'];
                 M('homsuser')->where("id = {$homsuser['id']}")->save($savedata);
             }
         } else {
             $this->error("HOMS账号已经用完,请及时录入!");
         }
         $the_current = time();
         $date_the_current = date("Y-m-d", $the_current);
         $apply = array();
         $apply['client_user'] = $homsuser['homsuser'];
         $apply['client_pass'] = $homsuser['homspass'];
         $apply['status'] = $examiney;
         $apply['examine_time'] = $the_current;
         $apply['info'] = $info;
         // $apply['endtime'] = strtotime(date("Y-m-d",strtotime("$date_the_current + $duration day")));
         $apply['endtime'] = getEndTime($duration, $the_current);
         $ret = M('shares_apply')->where("id = {$id}")->save($apply);
         if ($ret) {
             /* $applyfind = M('shares_apply')->where("id = {$id}")->find();
             			$vo = examinembermoney($applyfind['uid'],$applyfind['principal'],$applyfind['manage_fee'],$applyfind['order'],$applyfind['id']);
             			if($vo){ */
             alogs("examiney", 0, 1, '管理员执行了股票配资并填写homs信息操作成功!');
             $this->success('审核成功!');
             //}
         } else {
             alogs("examiney", 0, 1, '管理员执行了股票配资并填写homs信息操作失败!');
             $this->error('审核失败!');
         }
     } elseif ($_POST['examiney'] == 4) {
         //审核不通过退回本金
         $user_apply = M('shares_apply')->field("uid,principal")->where("id = {$id}")->find();
         $uid = $user_apply['uid'];
         $principal = $user_apply['principal'];
         $back_money = M('member_money')->field('back_money')->where("uid={$uid}")->find();
         $money['back_money'] = $back_money['back_money'] + $principal;
         //用户原有的余额+本金
         $updatem = M('member_money')->field('back_money')->where("uid={$uid}")->save($money);
         if ($updatem) {
             $apply = array();
             $apply['status'] = $examiney;
             $apply['examine_time'] = $the_current;
             $apply['info'] = $info;
             // $apply['endtime'] = strtotime(date("Y-m-d",strtotime("$date_the_current + $duration day")));
             $apply['endtime'] = getEndTime($duration, $the_current);
             $ret = M('shares_apply')->where("id = {$id}")->save($apply);
             if ($ret) {
                 $ainfo = $order . '管理员审核未通过,退还保证金';
                 pzmembermoneylod($principal, $uid, $ainfo, $id, 52);
                 $info = '很遗憾,您在手投网申请股票配资未通过,原因为' . $info . '!【手投网】';
                 sendsms($user['user_phone'], $info);
                 alogs("examiney", 0, 1, '管理员执行了股票配资审核不通过操作成功!');
                 $this->success('审核不通过操作成功!');
             } else {
                 alogs("examiney", 0, 1, '管理员执行了股票配资审核不通过操作失败!');
                 $this->error('审核不通过操作失败!');
             }
         } else {
             $this->error('审核不通过操作失败!');
         }
     }
 }
    if ($argv[1] == "--clean") {
        $tables = array("cc_schedule", "cc_show_instances", "cc_show");
        foreach ($tables as $table) {
            $query = "DELETE FROM {$table}";
            echo $query . PHP_EOL;
            query($conn, $query);
        }
        rabbitMqNotify();
        exit(0);
    } else {
        $str = <<<EOD
This script schedules a file to play 30 seconds in the future. It 
modifies the database tables cc_schedule, cc_show_instances and cc_show.
You can clean up these tables using the --clean option.
EOD;
        echo $str . PHP_EOL;
        exit(0);
    }
}
$startDateTime = new DateTime("now + 30sec", new DateTimeZone("UTC"));
//$endDateTime = new DateTime("now + 1min 30sec", new DateTimeZone("UTC"));
$starts = $startDateTime->format("Y-m-d H:i:s");
//$ends = $endDateTime->format("Y-m-d H:i:s");
$files = getFileFromCcFiles($conn);
$show_id = insertIntoCcShow($conn);
$endDateTime = getEndTime(clone $startDateTime, $files);
$ends = $endDateTime->format("Y-m-d H:i:s");
$show_instance_id = insertIntoCcShowInstances($conn, $show_id, $starts, $ends, $files);
insertIntoCcSchedule($conn, $files, $show_instance_id, $starts, $ends);
rabbitMqNotify();
echo PHP_EOL . "Show scheduled for {$starts} (UTC)" . PHP_EOL;