123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- <?php
- /**
- * Created by PhpStorm.
- * User: stanley-king
- * Date: 2017/5/25
- * Time: 上午9:30
- */
- require_once (BASE_ROOT_PATH . '/helper/statistics/stat_base.php');
- require_once (BASE_ROOT_PATH . '/helper/statistics/stbonus.php');
- require_once (BASE_ROOT_PATH . '/helper/statistics/stmember.php');
- require_once (BASE_ROOT_PATH . '/helper/statistics/statorder.php');
- require_once (BASE_ROOT_PATH . '/helper/statistics/statcall.php');
- require_once (BASE_ROOT_PATH . '/helper/statistics/behavior.php');
- require_once (BASE_ROOT_PATH . '/helper/statistics/stat_refill.php');
- require_once(BASE_ROOT_PATH . '/helper/brand_helper.php');
- require_once(BASE_ROOT_PATH . '/helper/category_helper.php');
- class stat_helper
- {
- const cur_date_type = 1;
- const last_week_type = 2;
- const last_hmonth_type = 3;
- const last_month_type = 4;
- //['time' => time(),'use_type' => $this->mUsedType,'rate' => $rate,'amount' => $used / 100,'member_id' => $this->member_id]
- public static function onUseBonus($param)
- {
- if(empty($param) || is_array($param) == false) {
- return false;
- }
- try
- {
- $time = intval($param['time']);
- $stat = new statistics\stbonus($time);
- $use_type = intval($param['use_type']);
- $rate = intval($param['rate']);
- $amount = $param['amount'];
- if($use_type == bonus_helper::pay_order_withold) {
- $stat->add_paied($rate,$amount);
- }
- elseif (($use_type == bonus_helper::send_bonus_withold)) {
- $stat->add_send($rate,$amount);
- }
- }
- catch (Exception $ex) {
- Log::record($ex->getMessage(),Log::ERR);
- }
- return true;
- }
- public static function onDaiyBonus($time)
- {
- try
- {
- $stat = new statistics\stbonus($time);
- $stat->daily();
- }
- catch(Exception $ex)
- {
- Log::record($ex->getMessage(),Log::ERR);
- }
- }
- public static function onInitSelfDiscount()
- {
- try
- {
- $stat = new statistics\stbonus(time());
- $stat->init_discount_self();
- }
- catch(Exception $ex)
- {
- Log::record($ex->getMessage(),Log::ERR);
- }
- }
- public static function onInitInviteesDiscount()
- {
- try
- {
- $stat = new statistics\stbonus(time());
- $stat->init_discount_invitee();
- }
- catch(Exception $ex)
- {
- Log::record($ex->getMessage(),Log::ERR);
- }
- }
- public static function onDailySelfDiscount($time)
- {
- try
- {
- $stat = new statistics\stbonus($time);
- $stat->discount_self();
- }
- catch(Exception $ex)
- {
- Log::record($ex->getMessage(),Log::ERR);
- }
- }
- public static function onDailyInviteeDiscount($time)
- {
- try
- {
- $stat = new statistics\stbonus($time);
- $stat->discount_invitee();
- }
- catch(Exception $ex)
- {
- Log::record($ex->getMessage(),Log::ERR);
- }
- }
- public static function onInvite()
- {
- try
- {
- $stat = new statistics\stmember(time());
- $stat->onInvite();
- }
- catch(Exception $ex)
- {
- Log::record($ex->getMessage(),Log::ERR);
- }
- }
- public static function onDaiyMember($time)
- {
- try
- {
- $stat = new statistics\stmember($time);
- $stat->daily();
- }
- catch(Exception $ex)
- {
- Log::record($ex->getMessage(),Log::ERR);
- }
- }
- public static function onDaiyOrder($time)
- {
- try
- {
- $stat = new statistics\statorder($time);
- $stat->daily();
- }
- catch(Exception $ex)
- {
- Log::record($ex->getMessage(),Log::ERR);
- }
- }
- public static function onDaiyBehavior($time)
- {
- try
- {
- $stat = new statistics\behavior();
- $stat->analyse($time);
- }
- catch(Exception $ex)
- {
- Log::record($ex->getMessage(),Log::ERR);
- }
- }
- public static function onDailyRefill()
- {
- $refill = new statistics\stat_refill();
- }
- }
|