dever 6 years ago
parent
commit
443810491e

+ 155 - 1
tm/lib/Controller/CmdLine/RunLog.class.php

@@ -4,6 +4,7 @@ namespace Cas\Controller\CmdLine;
 
 use Cas\Dao\LotteryPvUvLog;
 use KIF\Core\Config;
+use Cas\Dao\LotteryUserParticipateLog;
 
 /**
  * 分析前一天 /log/Pass_log 访问日志
@@ -72,14 +73,111 @@ class RunLog extends Controller {
 		foreach($tmpEventsUV as $events_id => $vps){
 			$eventsArr[$events_id]['uv'] = count($vps);
 		}
+
+		# 用户参与数
+		$objLotteryLog = new LotteryUserParticipateLog();
+		
+		foreach($eventsArr as $events_id => $data){
+			$info = array();
+
+			$time = strtotime('-1 day today');
+			/*
+			$start = $this->maketime(date('Y-m-d 00:00:00', $time));
+       	 	$end = $time;
+			# 参与人数
+			$info ['user_num'] = $objLotteryLog->getUserParticipateLogNumGroupByUidDate ($events_id, $start, $end);
+			*/
+
+			$info ['events_id'] = $events_id ;
+			$info ['pv_num'] = $data['pv'] ;
+			$info ['uv_num'] = $data['uv'] ;
+			$info ['ip_num'] = $data['ip'] ;
+			$info ['date'] = $time;
+			
+			$objDLotteryPvUvLog->add ( $info ,LotteryPvUvLog::PARAM_CREATE_ACTION_ONDUPLICATE);
+			
+		}
+		
+		
+		
+	}
+
+	/**
+	 * 跑出今天的 IP PV UV
+	 * php /export/manager/v2/v2_cas/www/index.php -cIndex -asetuser
+	 */
+	public function doToday() {
+		$objDLotteryPvUvLog = new LotteryPvUvLog ();
+		
+		# 获取今天目录下
+		$Y = date('Y');
+		$m = date('m');
+		$dir =Config::getInstance ()->get ( 'Log_Path' ).DIRECTORY_SEPARATOR.$Y.DIRECTORY_SEPARATOR.$m.DIRECTORY_SEPARATOR;
+		
+		$list = scandir($dir);
+		$thisList = array();
+		$name = 'Pass_log_'.date('Y_m_d');
+		foreach($list  as $data){
+			if(strpos($data, $name) !== false){
+				$thisList[$data] = $dir.$data;
+			}
+		}
+		$allData = array();
+		$eventsArr = array();
+		$tmpEventsIp = array();
+		$tmpEventsUV = array();
+		foreach($thisList as $thisDir){
+			 $string = file_get_contents($thisDir);
+			 $d = explode("\n", $string);
+			 foreach($d as $key=> $s){
+			 	if($s){
+			 		$arr = unserialize($s);
+			 		
+			 		if(isset($eventsArr[$arr['event_id']]['pv'])){
+			 			$eventsArr[$arr['event_id']]['pv'] ++;
+			 		}else{
+			 			$eventsArr[$arr['event_id']]['pv'] = 1;
+			 		}
+			 		
+			 		$tmpEventsIp[$arr['event_id']][$arr['ip']] = $arr['ip'];
+			 		
+			 		$tmpEventsUV[$arr['event_id']][$arr['ip'].$arr['user_agent']] = $arr['ip'].$arr['user_agent'];
+			 		
+			 		$allData[] = $arr;
+			 	}
+			 }
+		}
+		
+		
+		
+		# PV
+		# IP 
+		foreach($tmpEventsIp as $events_id => $ips){
+			$eventsArr[$events_id]['ip'] = count($ips);
+		}
+		
+		# UV
+		foreach($tmpEventsUV as $events_id => $vps){
+			$eventsArr[$events_id]['uv'] = count($vps);
+		}
+
+		# 用户参与数
+		$objLotteryLog = new LotteryUserParticipateLog();
 		
 		foreach($eventsArr as $events_id => $data){
 			$info = array();
+
+			$time = date();
+			$start = $this->maketime(date('Y-m-d 00:00:00', $time));
+       	 	$end = $time;
+			# 参与人数
+			$info ['user_num'] = $objLotteryLog->getUserParticipateLogNumGroupByUidDate ($events_id, $start, $end);
+
 			$info ['events_id'] = $events_id ;
 			$info ['pv_num'] = $data['pv'] ;
 			$info ['uv_num'] = $data['uv'] ;
 			$info ['ip_num'] = $data['ip'] ;
-			$info ['date'] = strtotime('-1 day today');
+			$info ['date'] = $time;
 			
 			$objDLotteryPvUvLog->add ( $info ,LotteryPvUvLog::PARAM_CREATE_ACTION_ONDUPLICATE);
 			
@@ -88,4 +186,60 @@ class RunLog extends Controller {
 		
 		
 	}
+
+	public function maketime($v)
+    {
+        if (!$v) {
+            return '';
+        }
+
+        if (is_numeric($v)) {
+            return $v;
+        }
+
+        if (is_array($v)) {
+            $v = $v[1];
+        }
+
+        if (strstr($v, ' ')) {
+            $t = explode(' ', $v);
+            $v = $t[0];
+            $s = explode(':', $t[1]);
+        } else {
+            $s = array(0, 0, 0);
+        }
+
+        if (!isset($s[1])) {
+            $s[1] = 0;
+        }
+
+        if (!isset($s[2])) {
+            $s[2] = 0;
+        }
+
+        if (strstr($v, '-')) {
+            $t = explode('-', $v);
+        } elseif (strstr($v, '/')) {
+            $u = explode('/', $v);
+            $t[0] = $u[2];
+            $t[1] = $u[0];
+            $t[2] = $u[1];
+        }
+
+        if (!isset($t)) {
+            $t = array(0, 0, 0);
+        }
+
+        if (!isset($t[1])) {
+            $t[1] = 0;
+        }
+
+        if (!isset($t[2])) {
+            $t[2] = 0;
+        }
+
+        $v = mktime($s[0], $s[1], $s[2], $t[1], $t[2], $t[0]);
+
+        return $v;
+    }
 }

+ 44 - 0
tm/lib/Controller/Express.class.php

@@ -132,6 +132,50 @@ class Express extends EventsController {
 		$objDLotteryData -> modify($lotteryDataExpressInfo,array('id' => $lottery_data_id));
 		self::ajax_success_exit('修改成功');
 	}
+
+	/**
+	 * 事件ajax : 只修改收货地址
+	 */
+	public function doUpExpressYes() {
+		$realname = Request::g('realname');
+		if (!$realname) {
+			self::ajax_fail_exit('请填写姓名');
+		}
+		$phone = Request::g('phone');
+		if (!$phone) {
+			self::ajax_fail_exit('请填写有效手机号码');
+		}
+		$address = Request::g('address');
+		if (!$address) {
+			self::ajax_fail_exit('请填写收货地址');
+		}
+
+		$sex = Request::g('sex');
+
+		if (!$sex) {
+			$sex = 1;
+		}
+		
+		# 获取用户信息
+		$objUserData = new UserInfo();
+		$uid = $this->getRunTimeUid();
+		$userData = $objUserData -> get($uid);
+
+		$objDLotteryUserExpress = new LotteryUserExpress();
+
+		$info = array(
+			'uid' => $uid,
+			'user_name' => $realname,
+			'phone' => $phone,
+			'address' => $address,
+			'sex' => $sex,
+		);
+		
+		$objDLotteryUserExpress -> add($info,AbstractDao::PARAM_CREATE_ACTION_REPLACE);
+		unset($info['uid']);
+
+		self::ajax_success_exit('修改成功');
+	}
 	
 	public function display() {
 		return $this->render();

+ 1 - 0
tm/lib/Dao/LotteryPvUvLog.class.php

@@ -23,6 +23,7 @@ class LotteryPvUvLog extends DBAgileDev {
 		'events_id',
 		'pv_num',
 		'uv_num',
+		'user_num',
 		'date'
 	);
 

+ 10 - 0
tm/lib/Dao/LotteryUserParticipateLog.class.php

@@ -53,5 +53,15 @@ class LotteryUserParticipateLog extends DBAgileDev {
 		}
 		return count($tmpResult);
 	}
+
+	public function getUserParticipateLogNumGroupByUidDate($eventsId, $start, $end){
+		$returnNum = 0;
+		$sql = "SELECT count(uid) FROM `{$this->tableName}` WHERE events_id={$eventsId} and create_time >= ".$start." and create_time <= ".$end." GROUP BY uid  ";
+		$tmpResult = $this->db->fetchAll($sql);
+		if (!$tmpResult) {
+			return $returnNum;
+		}
+		return count($tmpResult);
+	}
 	
 }

+ 1 - 1
tm/template_dir/events_infos.html

@@ -45,7 +45,7 @@
     <section class="recommend">
         <ul>
         <{foreach from=$focusData item=v}>
-            <li><a href="<{$v.link}>"><img src="<{$v.pic}>"><span><{$v.name}></span></a></li>
+            <li><a href="<{$v.link}>"><img src="<{$v.pic}>"></a></li>
         <{/foreach}>
         </ul>
     </section>

+ 1 - 1
tm/template_dir/gifts.html

@@ -1,7 +1,7 @@
 <{include file="header.html"}>
 <link rel="stylesheet" type="text/css" href="<{$web_cfg.cdn}>/haili/css/prizelist.css" />
 <!--公用标题居中显示-->
-<{include file="common_header.html"}>
+<header><a href="javascript:history.go(-1)" class="back"></a>我的奖品</header>
 
 
 <section class="prizelist">

+ 3 - 3
tm/template_dir/my.html

@@ -18,19 +18,19 @@
 <section class="mylist">
     <a href="<{$memberUrl}>act">
         <dl>
-            <dt><img src="../images/6445340f.ico-gift.png" />我参与的活动</dt>
+            <dt><img src="<{$web_cfg.cdn}>/haili/images/6445340f.ico-gift.png" />我参与的活动</dt>
             <dd><em class="ico-arrow"></em></dd>
         </dl>
     </a>
     <a href="<{$memberUrl}>gifts">
         <dl>
-            <dt><img src="../images/cf37e41f.ico-star.png" />我的奖品</dt>
+            <dt><img src="<{$web_cfg.cdn}>/haili/images/cf37e41f.ico-star.png" />我的奖品</dt>
             <dd><em class="ico-arrow"></em></dd>
         </dl>
     </a>
     <a href="<{$memberUrl}>set">
         <dl>
-            <dt><img src="../images/d205afc3.ico-setting.png" />资料设置</dt>
+            <dt><img src="<{$web_cfg.cdn}>/haili/images/d205afc3.ico-setting.png" />资料设置</dt>
             <dd><em class="ico-arrow"></em></dd>
         </dl>
     </a>

+ 1 - 1
tm/template_dir/my_act.html

@@ -5,7 +5,7 @@
     background: #fff url("<{$web_cfg.cdn}>/public/static/img/m-load.gif") no-repeat scroll 50% center / 20px 20px;
 }
 </style>
-<{include file="common_header.html"}>
+<header><a href="javascript:history.go(-1)" class="back"></a>我参与的活动</header>
 
 <{if $eventsData}>
 <section class="cardlist first-module">

+ 25 - 11
tm/template_dir/my_set.html

@@ -4,17 +4,17 @@
 <header><a href="javascript:history.go(-1)" class="back"></a>资料设置</header>
 <section class="applycont">
     <form>
-        <input type="text" id="realname" name="realname" placeholder="真实姓名" name="<{$my.user_name}>">
+        <input type="text" id="realname" name="realname" placeholder="真实姓名" value="<{$my.user_name}>">
         <select id="sex" name="sex" >
         	
-            <option <{if $my.sex != 2 && $my.sex != 3}>selected<{/if}>>性别</option>
-            <option <{if $my.sex == 2}>selected<{/if}>>男</option>
-            <option <{if $my.sex == 3}>selected<{/if}>>女</option>
+            <option <{if $my.sex != 2 && $my.sex != 3}>selected<{/if}> value="1">性别</option>
+            <option <{if $my.sex == 2}>selected<{/if}> value="2">男</option>
+            <option <{if $my.sex == 3}>selected<{/if}> value="3">女</option>
         </select>
-        <input type="text" id="phone" name="phone"  placeholder="手机号" name="<{$my.phone}>">
-        <textarea placeholder="通信地址" id="address" name="address" name="<{$my.address}>"></textarea>
+        <input type="text" id="phone" name="phone"  placeholder="手机号" value="<{$my.phone}>">
+        <textarea placeholder="通信地址" id="address" name="address" value="<{$my.address}>"><{$my.address}></textarea>
         <section class="button-wrapper">
-            <a class="button" id="sub_address">保存</a>
+            <a class="button" id="sub_address" style="cursor: pointer;">保存</a>
         </section>
     </form>
 </section>
@@ -42,6 +42,20 @@ KISSY.use('node, io', function (S, Node, IO) {
 			$(this).parent().find("span").show();
 		}	
 	});
+
+	// 提示
+	function showTipsBox(msg,close){
+
+		toast(msg, 1);
+		return;
+		$("#error_msg").html(msg);
+		$("#tips_close_btn").hide();
+		if(close){
+			$("#tips_close_btn").show();
+		}
+		$("#error_tips_box").fadeIn();
+		$('.a_cover').fadeIn();
+	}
 	
 	$('#sub_address').on('click', function () {
 		var realname = S.trim($('input[name=realname]').val());
@@ -57,7 +71,7 @@ KISSY.use('node, io', function (S, Node, IO) {
 			return false;
 		}
 		
-		var address = S.trim($('input[name=address]').val());
+		var address = S.trim($('textarea[name=address]').val());
 		if (address == '') {
 			showTipsBox('请填写收货地址',true);
 			return false;
@@ -69,9 +83,9 @@ KISSY.use('node, io', function (S, Node, IO) {
 			return false;
 		}
 		
-		IO.get('<{$web_cfg.domain}>/?c=Express&a=UpExpress'
+		IO.get('<{$web_cfg.domain}>/?c=Express&a=UpExpressYes'
 			, {
-				lottery_data_id: '<{$lotteryData.id}>',
+				//lottery_data_id: '<{$lotteryData.id}>',
 				realname: realname,
 				phone: phone,
 				address: address,
@@ -79,7 +93,7 @@ KISSY.use('node, io', function (S, Node, IO) {
 			}
 			, function (data) {
 				if (data.ok) {
-					location.reload();
+					toast('修改成功');
 				} else {
 					showTipsBox(data.msg);
 					return false;