|
@@ -10,6 +10,276 @@ class stat_dailyControl extends SystemControl
|
|
|
|
|
|
public function indexOp()
|
|
|
{
|
|
|
+ if (chksubmit()) {
|
|
|
+ }
|
|
|
+
|
|
|
+ $mod_stat = Model('stat');
|
|
|
+ $stat_list = $mod_stat->statDailyList([], '*', 30);
|
|
|
+
|
|
|
+ Tpl::output('page',$mod_stat->showpage());
|
|
|
+ Tpl::output('dailies',$stat_list);
|
|
|
+ Tpl::output('colomns',$this->daily_colomns());
|
|
|
+
|
|
|
Tpl::showpage('stat.daily.list');
|
|
|
+
|
|
|
+ }
|
|
|
+ private function daily_colomns()
|
|
|
+ {
|
|
|
+ return ['日期','可用金额','可用个数','今日发送金额','今日未领金额','今日发送个数','今日领取个数','红包支付金额','红包转发金额','红包转发次数','新增用户','总用户','日活','周活','月活','订单总数','订单总额','客单价'];
|
|
|
+ }
|
|
|
+
|
|
|
+ public function interactive_listOp()
|
|
|
+ {
|
|
|
+ $mod_stat = Model('stat');
|
|
|
+ $stat_list = $mod_stat->statDailyList([], 'date_id,call_record', 30);
|
|
|
+
|
|
|
+ Tpl::output('page',$mod_stat->showpage());
|
|
|
+ Tpl::output('dailies',$stat_list);
|
|
|
+ Tpl::output('colomns',$this->call_colomns());
|
|
|
+
|
|
|
+ Tpl::showpage('stat.interactive.list');
|
|
|
+ }
|
|
|
+
|
|
|
+ private function call_colomns()
|
|
|
+ {
|
|
|
+ return ['日期','IOS','android','H5','首页','品牌页','专题','搜索','功效','商品详情','获取验证码','红包打开','发送','从红包发送','摇一摇','红包分享','邀请','收藏','我的F码','商城','我的订单'];
|
|
|
+ }
|
|
|
+
|
|
|
+ public function interactive_goodsOp()
|
|
|
+ {
|
|
|
+ Tpl::showpage('stat.interactive.goods');
|
|
|
+ }
|
|
|
+
|
|
|
+ public function interactive_specialOp()
|
|
|
+ {
|
|
|
+ $date_id = $_GET['date_id'];
|
|
|
+ $mod_stat = Model('stat');
|
|
|
+ $stat_list = $mod_stat->statDailyList(['date_id' => $date_id], 'date_id,call_record');
|
|
|
+ if(empty($stat_list) || empty($stat_list[0]['call_record'])) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $record = json_decode($stat_list[0]['call_record'],true);
|
|
|
+ $specials = $this->all_special($record);
|
|
|
+
|
|
|
+ Tpl::output('dailies',$specials);
|
|
|
+ Tpl::output('colomns',$this->special_colomns());
|
|
|
+
|
|
|
+ Tpl::showpage('stat.interactive.special');
|
|
|
+ }
|
|
|
+ private function special_colomns()
|
|
|
+ {
|
|
|
+ return ['专题编号','名称','点击量','子专题'];
|
|
|
+ }
|
|
|
+ private function all_special($record)
|
|
|
+ {
|
|
|
+ $other = $record['other'];
|
|
|
+ if(empty($other)) return false;
|
|
|
+
|
|
|
+ $specials = [];
|
|
|
+ foreach ($other as $key => $value)
|
|
|
+ {
|
|
|
+ $params = preg_split('/_/', $key);
|
|
|
+ if($params != false && count($params) == 2)
|
|
|
+ {
|
|
|
+ if($params[0] == 'special')
|
|
|
+ {
|
|
|
+ $special_id = intval($params[1]);
|
|
|
+ $count = $value['count'];
|
|
|
+ $specials[] = new special_item($special_id,$count);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!empty($specials)) {
|
|
|
+ uasort($specials,['special_item','count_desc']);
|
|
|
+
|
|
|
+ }
|
|
|
+ return $specials;
|
|
|
+ }
|
|
|
+}
|
|
|
+class special_item
|
|
|
+{
|
|
|
+ private $mSpId;
|
|
|
+ private $mCount;
|
|
|
+ public function __construct($special_id,$count)
|
|
|
+ {
|
|
|
+ $this->mSpId = $special_id;
|
|
|
+ $this->mCount = $count;
|
|
|
+ }
|
|
|
+ public function count() {
|
|
|
+ return $this->mCount;
|
|
|
+ }
|
|
|
+ public function fields()
|
|
|
+ {
|
|
|
+ $result = [];
|
|
|
+ $result[] = $this->mSpId;
|
|
|
+ $result[] = $this->special_name();
|
|
|
+ $result[] = $this->mCount;
|
|
|
+
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
+ private function special_name()
|
|
|
+ {
|
|
|
+ $mod = Model('mb_special');
|
|
|
+ $special = $mod->getMbSpecialList(['special_id' => $this->mSpId]);
|
|
|
+ if(empty($special)) return false;
|
|
|
+ return $special[0]['special_desc'];
|
|
|
+ }
|
|
|
+ private function sub_specials()
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+ static public function count_desc($left,$right)
|
|
|
+ {
|
|
|
+ $t_l = intval($left->count());
|
|
|
+ $t_r = intval($right->count());
|
|
|
+
|
|
|
+ if($t_l > $t_r) return -1;
|
|
|
+ elseif($t_l < $t_r) return 1;
|
|
|
+ else return 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+class call_item
|
|
|
+{
|
|
|
+ private $mDateID;
|
|
|
+ private $mRecord;
|
|
|
+ public function __construct($item)
|
|
|
+ {
|
|
|
+ $this->mDateID = $item['date_id'];
|
|
|
+ $srecord = $item['call_record'];
|
|
|
+ if(empty($srecord)) {
|
|
|
+ $this->mRecord = [];
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ $this->mRecord = json_decode($srecord,true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public function date_id() {
|
|
|
+ return $this->mDateID;
|
|
|
+ }
|
|
|
+ public function date()
|
|
|
+ {
|
|
|
+ return strftime('%Y-%m-%d',intval($this->mDateID));
|
|
|
+ }
|
|
|
+ public function fields()
|
|
|
+ {
|
|
|
+ $result = [];
|
|
|
+ $result[] = $this->date();
|
|
|
+ if(empty($this->mRecord)) return $result;
|
|
|
+
|
|
|
+ $result[] = $this->mRecord['ios_count'];
|
|
|
+ $result[] = $this->mRecord['android_count'];
|
|
|
+ $result[] = $this->mRecord['wap_count'];
|
|
|
+
|
|
|
+ $funs = $this->mRecord['function'];
|
|
|
+ $result[] = $this->accumulate($funs['index']);
|
|
|
+ $result[] = $this->accumulate($funs['brand']);
|
|
|
+ $result[] = $this->accumulate($funs['special']);
|
|
|
+ $result[] = $this->accumulate($funs['search']);
|
|
|
+ $result[] = $this->accumulate($funs['category']);
|
|
|
+ $result[] = $this->accumulate($funs['goods_common']);
|
|
|
+ $result[] = $this->accumulate_op($funs['login'],'getcodex');
|
|
|
+
|
|
|
+ $result[] = $this->accumulate_op($funs['bonusex'],'open');
|
|
|
+ $result[] = $this->accumulate_op($funs['member_bonus'],'make');
|
|
|
+ $result[] = $this->accumulate_op($funs['member_bonus'],'makeby_bonus');
|
|
|
+ $result[] = $this->accumulate_op($funs['member_bonus'],'shake');
|
|
|
+ $result[] = $this->accumulate_op($funs['member_bonus'],'share');
|
|
|
+ $result[] = $this->accumulate_op($funs['member_bonus'],'invite');
|
|
|
+ $result[] = $this->accumulate($funs['member_favorites']);
|
|
|
+ $result[] = $this->accumulate($funs['member_fcode']);
|
|
|
+ $result[] = $this->accumulate($funs['mshop']);
|
|
|
+ $result[] = $this->accumulate($funs['member_order']);
|
|
|
+
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
+ private function accumulate($act)
|
|
|
+ {
|
|
|
+ if(empty($act)) return 0;
|
|
|
+
|
|
|
+ $count = 0;
|
|
|
+ foreach ($act as $op => $val) {
|
|
|
+ $count += $val['count'];
|
|
|
+ }
|
|
|
+ return $count;
|
|
|
+ }
|
|
|
+ private function accumulate_op($act,$op)
|
|
|
+ {
|
|
|
+ if(empty($act)) return 0;
|
|
|
+ foreach ($act as $key => $val)
|
|
|
+ {
|
|
|
+ if($key == $op) {
|
|
|
+ return $val['count'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+class daily_item
|
|
|
+{
|
|
|
+ private $mItem;
|
|
|
+ public function __construct($item)
|
|
|
+ {
|
|
|
+ $this->mItem = $item;
|
|
|
+ }
|
|
|
+ public function date()
|
|
|
+ {
|
|
|
+ return strftime('%Y-%m-%d',intval($this->mItem['date_id']));
|
|
|
+ }
|
|
|
+ public function fields()
|
|
|
+ {
|
|
|
+ $result = [];
|
|
|
+ $result[] = $this->date();
|
|
|
+ $result[] = $this->accumulate($this->mItem['available_total_amount']);
|
|
|
+ $result[] = $this->mItem['available_count'];
|
|
|
+ $result[] = $this->accumulate($this->mItem['all_total_amount']);
|
|
|
+ $result[] = $this->accumulate($this->mItem['all_remain_amount']);
|
|
|
+ $result[] = $this->mItem['all_bonus_count'];
|
|
|
+ $result[] = $this->mItem['all_bind_count'];
|
|
|
+ $result[] = $this->accumulatex($this->mItem['bonus_pay_amount']);
|
|
|
+ $result[] = $this->accumulatex($this->mItem['person_send_amount']);
|
|
|
+ $result[] = $this->mItem['all_bonus_count'] - $this->mItem['admin_bonus_count'];
|
|
|
+ $result[] = 0;
|
|
|
+ $result[] = $this->mItem['member_total_num'];
|
|
|
+ $result[] = $this->mItem['day_active_member'];
|
|
|
+ $result[] = $this->mItem['week_active_member'];
|
|
|
+ $result[] = $this->mItem['month_active_member'];
|
|
|
+ $result[] = $this->mItem['order_total_num'];
|
|
|
+ $result[] = $this->mItem['order_amount'];
|
|
|
+ $result[] = $this->mItem['order_price_avg'];
|
|
|
+
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
+ private function accumulate($input)
|
|
|
+ {
|
|
|
+ $total = 0;
|
|
|
+ if(empty($input)) return $total;
|
|
|
+
|
|
|
+ $moneys = unserialize($input);
|
|
|
+ if($moneys == false) return $total;
|
|
|
+
|
|
|
+ foreach ($moneys as $val)
|
|
|
+ {
|
|
|
+ if(empty($val)) continue;
|
|
|
+ foreach ($val as $rate => $money) {
|
|
|
+ $total += $money;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $total;
|
|
|
+ }
|
|
|
+ private function accumulatex($input)
|
|
|
+ {
|
|
|
+ $total = 0;
|
|
|
+ if(empty($input)) return $total;
|
|
|
+
|
|
|
+ $moneys = unserialize($input);
|
|
|
+ if($moneys == false) return $total;
|
|
|
+
|
|
|
+ foreach ($moneys as $rate => $money)
|
|
|
+ {
|
|
|
+ $total += $money;
|
|
|
+ }
|
|
|
+ return $total;
|
|
|
}
|
|
|
}
|