Procházet zdrojové kódy

Merge branch 'master' of iqiyoo:zhuishuyun_wap

onlinetest před 6 roky
rodič
revize
1426ed6e80
100 změnil soubory, kde provedl 84 přidání a 10292 odebrání
  1. 0 49
      app/Console/Commands/AutoSendTrusteeShipCustomerMsg.php
  2. 0 72
      app/Console/Commands/AutoWithdrawCash.php
  3. 0 46
      app/Console/Commands/BillTask.php
  4. 0 72
      app/Console/Commands/BookGiftStats/BookGiftStatsByBook.php
  5. 0 74
      app/Console/Commands/BookGiftStats/BookGiftStatsByGift.php
  6. 84 74
      app/Console/Commands/BookSpider.php
  7. 0 131
      app/Console/Commands/BusinessChannelStatTask.php
  8. 0 56
      app/Console/Commands/CP/GenerateCpBookBetweenStat.php
  9. 0 49
      app/Console/Commands/CP/GenerateCpBookStat.php
  10. 0 42
      app/Console/Commands/ChangePay.php
  11. 0 74
      app/Console/Commands/Channel/CheckStatus.php
  12. 0 72
      app/Console/Commands/ChannelReaderVisitStats.php
  13. 0 66
      app/Console/Commands/ChapterImageTask.php
  14. 0 152
      app/Console/Commands/ChapterOrderTotal.php
  15. 0 75
      app/Console/Commands/ChargeTemplateStat.php
  16. 0 47
      app/Console/Commands/CheckAndSend.php
  17. 0 106
      app/Console/Commands/CheckBookCover.php
  18. 0 47
      app/Console/Commands/CheckOfficialAccountTemplate.php
  19. 0 190
      app/Console/Commands/CheckSiteStatus.php
  20. 0 126
      app/Console/Commands/CheckZhangDuSiteStatus.php
  21. 0 46
      app/Console/Commands/CustomSignPush.php
  22. 0 46
      app/Console/Commands/CustomSubscribePush.php
  23. 0 61
      app/Console/Commands/DistributionStats/WeeklyDailyStats.php
  24. 0 59
      app/Console/Commands/DownPic.php
  25. 0 214
      app/Console/Commands/FailOrderAlert.php
  26. 0 46
      app/Console/Commands/ForBiddenOfficialAccountRemind.php
  27. 0 263
      app/Console/Commands/ForceUserActive.php
  28. 0 241
      app/Console/Commands/ForceUserActive.php.bak
  29. 0 244
      app/Console/Commands/ForceUserActive.php.bakk
  30. 0 148
      app/Console/Commands/ForceUserActiveDetail.php
  31. 0 33
      app/Console/Commands/Inspire.php
  32. 0 123
      app/Console/Commands/MovedChannelsReback.php
  33. 0 46
      app/Console/Commands/NoPayRemind.php
  34. 0 71
      app/Console/Commands/OfficialAccountBillsTask.php
  35. 0 214
      app/Console/Commands/OfficialAccountStat/SubUserRecharge.php
  36. 0 47
      app/Console/Commands/PaidUserRemind.php
  37. 0 107
      app/Console/Commands/PayChannelCheck.php
  38. 0 111
      app/Console/Commands/PaymentQueryTask.php
  39. 0 62
      app/Console/Commands/PaymentStatisticTask.php
  40. 0 49
      app/Console/Commands/ProductStats/DailyProductionStats.php
  41. 0 49
      app/Console/Commands/ProductStats/MonthlyProductionStats.php
  42. 0 89
      app/Console/Commands/ProductStats/SendDailyProductionStats.php
  43. 0 84
      app/Console/Commands/ProductStats/SendMonthStatsEmail.php
  44. 0 75
      app/Console/Commands/ProductStats/SendMonthlyProductStats.php
  45. 0 47
      app/Console/Commands/RecoverPush.php
  46. 0 76
      app/Console/Commands/RepeatBookOrderRecover.php
  47. 0 85
      app/Console/Commands/SendOrder/GenerateBookUvRegisterStat.php
  48. 0 54
      app/Console/Commands/SendOrder/GenerateForceDayStat.php
  49. 0 51
      app/Console/Commands/SendOrder/GenerateStat.php
  50. 0 151
      app/Console/Commands/SendOrder/SendStatsEmail.php
  51. 0 188
      app/Console/Commands/SendOrder/SetExtraStats.php
  52. 0 84
      app/Console/Commands/SendOrder/UserActivityStats.php
  53. 0 59
      app/Console/Commands/SendOrderBreakevenForceUser.php
  54. 0 53
      app/Console/Commands/SendServiceMsg.php
  55. 0 133
      app/Console/Commands/SignReward.php
  56. 0 47
      app/Console/Commands/SmartPush/AllPushHotBook.php
  57. 0 47
      app/Console/Commands/SmartPush/LongChapterCustom.php
  58. 0 48
      app/Console/Commands/SmartPush/LongChapterTemplate.php
  59. 0 47
      app/Console/Commands/SmartPush/PaidPushPointBook.php
  60. 0 47
      app/Console/Commands/SmartPush/PaidUserCustom.php
  61. 0 47
      app/Console/Commands/SmartPush/UnPaidPushHotBook.php
  62. 0 47
      app/Console/Commands/SmartPush/UnPaidPushPointBook.php
  63. 0 46
      app/Console/Commands/SmartPush/UnPaidUserBigActivity.php
  64. 0 46
      app/Console/Commands/SmartPush/UnPaidUserSmallActivity.php
  65. 0 116
      app/Console/Commands/Sub/GenerateCpSubDayStat.php
  66. 0 123
      app/Console/Commands/SubscribeAlert.php
  67. 0 116
      app/Console/Commands/SubscribeDataStats.php
  68. 0 64
      app/Console/Commands/SuperiorBooks/DailyScanForSupriorNewBook.php
  69. 0 47
      app/Console/Commands/SuperiorBooks/HistorySupriorBook.php
  70. 0 132
      app/Console/Commands/SuperiorBooks/TempCommand.php
  71. 0 129
      app/Console/Commands/Temp/FansArpu.php
  72. 0 61
      app/Console/Commands/Temp/FixRealReg.php
  73. 0 148
      app/Console/Commands/Temp/OfficialAccountSubStat.php
  74. 0 244
      app/Console/Commands/Temp/PayUserAutoSub.php
  75. 0 123
      app/Console/Commands/Temp/SelectPayUser.php
  76. 0 106
      app/Console/Commands/Temp/SensitiveChapter.php
  77. 0 92
      app/Console/Commands/Temp/Siorder.php
  78. 0 92
      app/Console/Commands/Temp/UserSign.php
  79. 0 339
      app/Console/Commands/TemporaryTask.php
  80. 0 61
      app/Console/Commands/Tool/MaintainSubscribeReplyRedisData.php
  81. 0 50
      app/Console/Commands/Tool/MaintainTempForceSubscribeUser.php
  82. 0 87
      app/Console/Commands/Tool/OfficialAccountUserTranser.php
  83. 0 75
      app/Console/Commands/Tool/TestSmartPush.php
  84. 0 164
      app/Console/Commands/Tool/ThirdPlatomUserTranser.php
  85. 0 87
      app/Console/Commands/Tool/TitleImageStatistics.php
  86. 0 85
      app/Console/Commands/Trade/GenerateOrderDayStat.php
  87. 0 58
      app/Console/Commands/Trade/GenerateOrderStat.php
  88. 0 46
      app/Console/Commands/UnPaidUserActivity.php
  89. 0 64
      app/Console/Commands/UpdateBookClickCount.php
  90. 0 209
      app/Console/Commands/UserPayUpdateTask.php
  91. 0 52
      app/Console/Commands/UserSubscribleStatistic.php
  92. 0 697
      app/Console/Commands/WapVisitStat.php
  93. 0 327
      app/Console/Commands/WechatCustumerPushStatistical.php
  94. 0 110
      app/Console/Commands/WelfareNextDay.php
  95. 0 119
      app/Console/Commands/WelfarePrize.php
  96. 0 84
      app/Console/Commands/WholeBookOrderData.php
  97. 0 75
      app/Console/Commands/XcxStastical.php
  98. 0 74
      app/Console/Commands/fansMaximumNotice.php
  99. 0 285
      app/Console/Kernel.php
  100. 0 0
      app/Http/Controllers/Wap/BaseController.php

+ 0 - 49
app/Console/Commands/AutoSendTrusteeShipCustomerMsg.php

@@ -1,49 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use App\Modules\OfficialAccount\Services\BatchCustomMsgService;
-class AutoSendTrusteeShipCustomerMsg extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'AutoSendTrusteeShipCustomerMsg';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '自动推送托管客服消息';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-//         $this->autoSendTrusteeShipCustomerMsg();
-    }
-
-    public function autoSendTrusteeShipCustomerMsg(){
-    	// 女频
-        BatchCustomMsgService::autoSendTrusteeShipCustomerMsg('b');
-        // 男频
-        BatchCustomMsgService::autoSendTrusteeShipCustomerMsg('a');
-    }
-}

+ 0 - 72
app/Console/Commands/AutoWithdrawCash.php

@@ -1,72 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use App\Modules\OfficialAccount\Services\OfficialAccountService;
-use App\Modules\Finance\Services\WithdrawCashService;
-use App\Modules\OfficialAccount\Models\DistributionSelfDefineConfig;
-use App\Modules\Finance\Services\FinancialStatService;
-
-class AutoWithdrawCash extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'AutoWithdrawCash';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '自动申请提现';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $this->start();
-    }
-
-    public function start(){
-    	\Log::info('auto_withdraw_cash_start');
-    	// 获取自动提现的渠道列表
-    	$distributionSelfDefineConfigs = DistributionSelfDefineConfig::getDistributionsByType('auto_withdraw_cash');
-    	foreach($distributionSelfDefineConfigs as $distributionSelfDefineConfig){
-    		try{
-    			$distribution_channel_id = $distributionSelfDefineConfig->distribution_channel_id;
-    			\Log::info('auto_withdraw_start:'.$distribution_channel_id);
-    			$financialStat = FinancialStatService::getFinancialStatSingle($distribution_channel_id);
-    			\Log::info($financialStat);
-    			if($financialStat['enable_withdrawal_amount'] >= 100){
-    				$amount = intval(($financialStat['enable_withdrawal_amount']*100))/100;
-    				\Log::info('real_amount:'.$amount.' orgin_amount:'.$financialStat['enable_withdrawal_amount']);
-    				$res = WithdrawCashService::auto_add_withdrawCash($distribution_channel_id,$amount,'系统自动申请提现');
-    				\Log::info('auto_withdraw:'.json_encode($res,JSON_UNESCAPED_UNICODE));
-    			}else{
-    				\Log::info('auto_withdraw_not_enough:'.$distribution_channel_id.' amount:'.$financialStat['enable_withdrawal_amount']);
-    			}
-    		}catch(Exception $e){
-    			\Log::info('auto_withdraw_cash_ept:'.$e->getMessage());
-    		}
-    		
-    	}
-    	\Log::info('auto_withdraw_cash_end');
-    }
-}

+ 0 - 46
app/Console/Commands/BillTask.php

@@ -1,46 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/20
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands;
-
-use App\Modules\Finance\Services\FinanceService;
-use Log;
-use Illuminate\Console\Command;
-
-class BillTask extends Command
-{
-    /**
-     * 执行命令   php artisan bill_task
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'bill_task';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '每日生成结算单生成';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        print_r("======每日生成结算单生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        Log::info("======每日生成结算单生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        FinanceService::makeDayDataStatistics();
-        Log::info("======每日生成结算单生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-        print_r("======每日生成结算单生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-    }
-}

+ 0 - 72
app/Console/Commands/BookGiftStats/BookGiftStatsByBook.php

@@ -1,72 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: songdb
- * Date: 2017/12/26
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands\BookGiftStats;
-
-use App\Modules\BookGifts\Services\BookGiftsStatsByBookService;
-use Log;
-use DB;
-use Illuminate\Console\Command;
-
-class BookGiftStatsByBook extends Command
-{
-    /**
-     * 执行命令   php artisan generate_order_day_stat
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'BookGiftDailyStatsByBook';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '送礼记录数据按书统计';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        print_r("======送礼记录数据按书统计 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        Log::info("======送礼记录数据按书统计 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        $start = date('Y-m-d 00:00:00',strtotime('-1 day'));
-        $end   = date('Y-m-d 23:59:59',strtotime('-1 day'));
-        $res = DB::select("SELECT bid,name,count(book_gifts_send.id) as send_times,COUNT(DISTINCT book_gifts_send.uid) as send_user_num,sum(book_gifts_send.cost) as cost_sum
- FROM book_gifts_send
- LEFT JOIN books ON books.id=book_gifts_send.bid
- WHERE book_gifts_send.created_at BETWEEN '{$start}' AND '{$end}'
- GROUP BY bid ");
-        foreach ($res as $item){
-            try{
-                $data_to_add = array(
-                    'date'=>date('Y-m-d'),
-                    'bid'=>$item->bid,
-                    'book_name'=>$item->name,
-                    'gift_send_times'=>$item->send_times,
-                    'gift_send_user_num'=>$item->send_user_num,
-                    'gift_send_cost'=>$item->cost_sum,
-                );
-
-                BookGiftsStatsByBookService::addBookStats($data_to_add);
-            }catch (\Exception $e){
-                \Log::error('add Book Gifts Stats Failed:'.$e->getMessage());
-            }
-        }
-
-        Log::info("======送礼记录数据按书统计 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-        print_r("======送礼记录数据按书统计 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-    }
-}

+ 0 - 74
app/Console/Commands/BookGiftStats/BookGiftStatsByGift.php

@@ -1,74 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: songdb
- * Date: 2017/12/26
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands\BookGiftStats;
-
-use DB;
-use App\Modules\BookGifts\Services\BookGiftsStatsByGiftService;
-use Log;
-use Illuminate\Console\Command;
-
-class BookGiftStatsByGift extends Command
-{
-    /**
-     * 执行命令   php artisan generate_order_day_stat
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'BookGiftDailyStatsByGift';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '送礼记录数据按礼物统计';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        print_r("======送礼记录数据按礼物统计 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        Log::info("======送礼记录数据按礼物统计 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        $start = date('Y-m-d 00:00:00',strtotime('-1 day'));
-        $end   = date('Y-m-d 23:59:59',strtotime('-1 day'));
-        \Log::info('start:'.$start);
-        \Log::info('end:'.$end);
-        $res = DB::select("SELECT gift_id,book_gifts.name_desc,count(book_gifts_send.id) as send_times,COUNT(DISTINCT book_gifts_send.uid) as send_user_num,sum(book_gifts_send.cost) as cost_sum
- FROM book_gifts_send
- LEFT JOIN book_gifts ON book_gifts.id=book_gifts_send.gift_id
- WHERE book_gifts_send.created_at BETWEEN '{$start}' AND '{$end}'
- GROUP BY gift_id");
-        foreach ($res as $item){
-            try{
-                $data_to_add = array(
-                    'date'=>date('Y-m-d'),
-                    'gift_id'=>$item->gift_id,
-                    'gift_name'=>$item->name_desc,
-                    'gift_send_times'=>$item->send_times,
-                    'gift_send_user_num'=>$item->send_user_num,
-                    'gift_send_cost'=>$item->cost_sum,
-                );
-
-                BookGiftsStatsByGiftService::addGiftStats($data_to_add);
-            }catch (\Exception $e){
-                \Log::error('add Book Gifts Stats Failed2:'.$e->getMessage());
-            }
-        }
-
-        Log::info("======送礼记录数据礼物统计 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-        print_r("======送礼记录数据按礼物统计 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-    }
-}

+ 84 - 74
app/Console/Commands/BookSpider.php

@@ -2,14 +2,9 @@
 
 namespace App\Console\Commands;
 
-use App\Modules\Statistic\Services\WapVisitStatService;
-use App\Modules\User\Services\UserService;
 use Illuminate\Console\Command;
 use GuzzleHttp\Client;
-use App\Modules\Book\Models\Book;
-use App\Modules\Book\Models\BookConfig;
 use DB;
-use Redis;
 
 class BookSpider extends Command
 {
@@ -25,7 +20,7 @@ class BookSpider extends Command
      *
      * @var string
      */
-    protected $description = '更新图书列表';
+    protected $description = 'zytest';
 
     /**
      * Create a new command instance.
@@ -45,85 +40,100 @@ class BookSpider extends Command
      */
     public function handle()
     {
-        //return $this->innerSendOrderId();
-        /*$a = $this->recordFirstIntoPayPage(1148,123,1645454);
-        print_r($a);*/
-
-        $this->getSpecialChannelIdStats();
+        //32401811
+        $this->cpc();
     }
 
-    /**
-     * 更新书籍列表
-     * @return int
-     */
-    public function innerSendOrderId(){
-        $template = "select CONCAT('template_',id) as id from `wechat_template_msgs` where del_flag=0 and is_show_list=1 and created_at >='2018-11-02' order by id desc limit 1000;
-";
-        $custom = "select CONCAT('custom_',id) as id from `custom_send_msgs` where del_flag=0 and is_show_list=1 and created_at >='2018-11-02' order by id desc limit 10000;
-";
-        $t = DB::select($template);
-        if($t){
-            foreach ($t as $v){
-                $uv = Redis::SMEMBERS('push:distribution_channel_id:alluv:from:' . $v->id);
-                $pv = Redis::hget('push:distribution_channel_id:allpv' , $v->id);
-                if($uv){
-                    Redis::sadd('push:inner_send_order_id:uv:' . $v->id,$uv);
-                }
-                if($uv){
-                    Redis::hset('push:inner_send_order_id:pv' ,$v->id,$pv);
+    private function cpc(){
+        //32426552
+
+        $sql_format = "SELECT u.id,f.created_at as subscribe_time,u.openid,
+(SELECT ifnull(sum(price),0) from orders where uid = u.id and `status` = 'PAID' LIMIT 1)as amount,
+(SELECT ifnull(sum(price),0) from orders where uid=u.id and `status` = 'PAID' and created_at <= DATE_ADD(f.created_at,INTERVAL 3 day)) as three_day_amount
+  FROM users u
+JOIN force_subscribe_users f on u.id = f.uid 
+WHERE u.openid in (SELECT openid from users WHERE  id = %s)";
+        $all = 32427;
+        for ($i =0;$i<=$all;$i++){
+            $subscribes = DB::table('force_subscribe_users')->where('id','>',$i*1000)->select('uid')->limit(1000)->get();
+            if($subscribes->isEmpty()){
+                break;
+            }
+            foreach ($subscribes as $value){
+                $result = DB::select(sprintf($sql_format,$value->uid));
+                if($result){
+                    $user_property_info = $this->level($result);
+                    $this->create($user_property_info);
                 }
             }
         }
+    }
 
-        $c = DB::select($custom);
-        if($c){
-            foreach ($c as $val){
-                $uv = Redis::SMEMBERS('push:distribution_channel_id:alluv:from:' . $val->id);
-                $pv = Redis::hget('push:distribution_channel_id:allpv' , $val->id);
-                if($uv){
-                    Redis::sadd('push:inner_send_order_id:uv:' . $val->id,$uv);
-                }
-                if($pv){
-                    Redis::hset('push:inner_send_order_id:pv' ,$val->id,$pv);
-                }
+    private function level($res){
+        $earliest_subscribe_time = $res[0]->subscribe_time;
+        $subscribe_three_day_info = [];
+        $subscribe_no_three_day_info = [];
+        foreach ($res as $v){
+            (strtotime($v->subscribe_time) < strtotime($earliest_subscribe_time)) && $earliest_subscribe_time = $v->subscribe_time;
+            if(time()-strtotime($v->subscribe_time) >= 86400*3){
+                array_push($subscribe_three_day_info,$v->amount);
+            }else{
+                array_push($subscribe_no_three_day_info,$v->three_day_amount);
+            }
+        }
+        $result = [
+            'earliest_subscribe_time'=>$earliest_subscribe_time,
+            'property'=>'',
+            'type'=>'',
+            'openid'=> $res[0]->openid
+        ];
+        if($subscribe_three_day_info){
+            //存量用户
+            $result['type'] = 'CUILIANG';
+            $amount = round(array_sum($subscribe_three_day_info)/count($subscribe_three_day_info),2);
+            if($amount>15){
+                $result['property'] = 'high';
+            }elseif($amount >2){
+                $result['property'] = 'medium';
+            } elseif($amount >0){
+                $result['property'] = 'low';
+            } else{
+                $result['property'] = 'none';
+            }
+        }else{
+            //新用户
+            $result['type'] = 'NEW';
+            if($subscribe_no_three_day_info)
+                $amount = max($subscribe_no_three_day_info);
+            else
+                $amount = 0;
+            if($amount>50){
+                $result['property'] = 'high';
+            }elseif($amount >2){
+                $result['property'] = 'medium';
+            } elseif($amount >0){
+                $result['property'] = 'low';
+            } else{
+                $result['property'] = 'none';
             }
         }
-    }
 
-    private function getSpecialChannelIdStats(){
-        $result = WapVisitStatService::getSpecialChannelIdStats(168502,'2018-11-24');
-        print_r($result);
+        return $result;
     }
 
-
-
-    private function recordFirstIntoPayPage($bid,$distribution_channel_id,$uid)
-    {
-        $start_time = env('RECORD_FIRST_VISIT_PAY_PAGE_TIME');
-        $template_id = 0;
-        if ($distribution_channel_id == 123 && $start_time && $uid) {
-            $user = UserService::getById($uid);
-            if (strtotime($user->created_at) > $start_time) {
-                $old = DB::table('user_first_visit_pay_page')->where('uid', $uid)->select('uid', 'template_type')->first();
-                if ($old) {
-                    $template_id = $old->template_type;
-                }
-                if ($bid && $bid == 1148) {
-                    $template_id = $uid % 2 == 0 ? 2 : 1;
-                    if (!$old) {
-                        try {
-                            DB::table('user_first_visit_pay_page')->insert([
-                                'uid' => $uid,
-                                'template_type' => $template_id,
-                                'created_at' => date('Y-m-d H:i:s'),
-                                'updated_at' => date('Y-m-d H:i:s')
-                            ]);
-                        } catch (\Exception $e) {
-                        }
-                    }
-                }
-            }
+    private function create($data){
+        $old = DB::table('user_division_cpc_property')->where('openid',$data['openid'])->where('is_enable',1)->first();
+        if(!$old){
+            DB::table('user_division_cpc_property')->insert([
+               'openid'=>$data['openid'] ,
+               'property'=>$data['property'] ,
+               'is_enable'=>1 ,
+               'type'=>$data['type'] ,
+               'earliest_subscribe_time'=>$data['earliest_subscribe_time'] ,
+                'created_at'=>date('Y-m-d H:i:s'),
+                'updated_at'=>date('Y-m-d H:i:s')
+            ]);
         }
-        return $template_id;
     }
+
 }

+ 0 - 131
app/Console/Commands/BusinessChannelStatTask.php

@@ -1,131 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/12/26
- * Time: 下午3:29
- */
-
-namespace App\Console\Commands;
-
-use App\Modules\Channel\Services\BusinessChannelDayStatService;
-use App\Modules\Channel\Services\BusinessChannelStatService;
-use App\Modules\Channel\Services\ChannelOrdersService;
-use App\Modules\Channel\Services\ChannelService;
-use App\Modules\OfficialAccount\Services\ForceSubscribeService;
-use App\Modules\SendOrder\Services\SendOrderService;
-use App\Modules\Statistic\Services\WapVisitStatService;
-use App\Modules\User\Services\UserService;
-use Log;
-use Illuminate\Console\Command;
-
-class BusinessChannelStatTask extends Command
-{
-
-    /**
-     * 执行命令   php artisan BusinessChannelStat_task
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'BusinessChannelStat_task';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '每日商务渠道数据生成';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        print_r("======每日生商务渠道数据生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        Log::info("======每日商务渠道数据生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-
-        $dateNow = date("Y-m-d");
-//        $dateNow = "2018-01-30";
-
-        $yesterStartDay = date('Y-m-d', strtotime($dateNow." -1 day"))." 00:00:00";
-        $yesterEndDay = date('Y-m-d', strtotime($dateNow))." 00:00:00";
-
-        $last_monthStartDay = date('Y-m', strtotime($dateNow." -1 month"))."-01 00:00:00";
-        $current_monthStartDay = date('Y-m', strtotime($dateNow))."-01  00:00:00";
-
-        $beginLastweek=date('Y-m-d H:i:s',mktime(0,0,0,date('m'),date('d')-date('w')+1-7,date('Y')));
-        $endLastweek=date('Y-m-d H:i:s',mktime(23,59,59,date('m'),date('d')-date('w')+7-7,date('Y')));
-
-        $current_week_start = date("Y-m-d H:i:s",mktime(0, 0 , 0,date("m"),date("d")-date("w")+1,date("Y")));
-        $current_week_end = date("Y-m-d H:i:s",mktime(23,59,59,date("m"),date("d")-date("w")+7,date("Y")));
-
-        $channels = ChannelService::getAllChannels();
-        foreach ($channels as $channel) {
-            $userRegisterNum = UserService::getChannelDayTotal($channel['id'], $yesterStartDay);
-            $sendOrderDataNum = SendOrderService::getDuraingPromotionCountByChannelId($channel['id'], $yesterStartDay, $yesterEndDay);
-            $data = WapVisitStatService::getReaderUvAndPv($channel, date('Y-m-d',strtotime('-1 day')));
-            $whole_pv=$whole_uv=0;
-            if ($data) {
-                $whole_uv = $data['uv'];
-                $whole_pv = $data['pv'];
-            }
-            try{
-                $paramsA = [
-                    'distribution_channel_id' => $channel['id'],
-                    'date' => $yesterStartDay,
-                    'register_user_num' => $userRegisterNum,
-                    'send_order_num' => $sendOrderDataNum,
-                    'is_login_yesterday'=>UserService::judgeUserYesterdayLogin($channel['id'],$yesterStartDay,$yesterEndDay),
-                    'whole_site_uv'=>$whole_uv,
-                    'whole_site_pv'=>$whole_pv,
-                    'auto_force_sub_num'=>BusinessChannelDayStatService::getAutoForceSubUserNum($channel['id'],$yesterStartDay,$yesterEndDay),
-                    'self_force_sub_num'=>BusinessChannelDayStatService::getSelfForceSubUserNum($channel['id'],$yesterStartDay,$yesterEndDay),
-                    'subscribe_user_num'=>BusinessChannelDayStatService::getChannelSubscribeNum($channel['id'],$yesterStartDay,$yesterEndDay),
-                    'subscribe_amount'  =>BusinessChannelDayStatService::getChannelSubscribeRecharge($channel['id'],$yesterStartDay,$yesterEndDay)
-                ];
-                BusinessChannelDayStatService::createBusinessChannelDayStat($paramsA);
-            }catch (\Exception $exception){
-                \Log::error($exception->getMessage());
-            }
-
-            $yesterday_register_user_num = $userRegisterNum;
-            $current_month_register_user_num = UserService::getChannelDayToDayTotal([$channel['id']], $current_monthStartDay, $yesterEndDay);
-            $last_month_register_user_num = UserService::getChannelDayToDayTotal([$channel['id']], $last_monthStartDay, $current_monthStartDay);
-            $total_register_user_num = UserService::getChannelDayToDayTotal([$channel['id']], '', $yesterEndDay);
-            $total_send_order_num = SendOrderService::getPromotionCountByChannelId($channel['id']);
-            $current_month_new_channel_recharge = ChannelOrdersService::getCurrentMonthNewChannelsOrdersSum($channel['id']);
-            $current_month_channel_recharge = ChannelOrdersService::getChannelsOrdersSum($channel['id'],$current_monthStartDay);
-
-            $paramsB = [
-                'yesterday_register_user_num' => $yesterday_register_user_num,
-                'current_month_register_user_num' => $current_month_register_user_num,
-                'last_month_register_user_num' => $last_month_register_user_num,
-                'total_register_user_num' => $total_register_user_num,
-                'total_send_order_num' => $total_send_order_num,
-                'current_month_new_channels_recharge'=>$current_month_new_channel_recharge,
-                'current_month_channels_recharge'=>$current_month_channel_recharge,
-
-                'service_account_num' =>BusinessChannelStatService::getServiceAccountNum($channel['id']),
-                'last_week_login_days' =>BusinessChannelStatService::getLoginDays($channel['id'],$beginLastweek,$endLastweek),
-                'current_week_login_days'=>BusinessChannelStatService::getLoginDays($channel['id'],$current_week_start,$current_week_end),
-                'last_week_actual_send_orders'=>SendOrderService::getPeriodActualSendOrdersNum($channel['id'], $beginLastweek,$endLastweek),
-                'current_week_actual_send_orders'=>SendOrderService::getPeriodActualSendOrdersNum($channel['id'], $current_week_start,$current_week_end),
-                'yesterday_create_orders'=>SendOrderService::getDuraingPromotionCountByChannelId($channel['id'],$yesterStartDay,$yesterEndDay),
-                'is_login_yesterday'=>$paramsA['is_login_yesterday'],
-                'last_month_channels_recharge'=>BusinessChannelStatService::getLastMonthChannelRecharge($channel['id']),
-                'last_month_new_channel_recharge'=>BusinessChannelStatService::getLastMonthNewChannelRecharge($channel['id']),
-
-            ];
-            //\Log::info('paramB'.json_encode($paramsB));
-            BusinessChannelStatService::crateUpdate($channel['id'], $paramsB);
-        }
-
-        Log::info("======每日商务渠道数据生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-        print_r("======每日商务渠道数据生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-    }
-}

+ 0 - 56
app/Console/Commands/CP/GenerateCpBookBetweenStat.php

@@ -1,56 +0,0 @@
-<?php
-/**
- * zhoulj
- * 2018-05-15
- */
-
-namespace App\Console\Commands\CP;
-
-use App\Modules\CP\Services\GenerateCpBookStatService;
-use Illuminate\Console\Command;
-use Log;
-
-class GenerateCpBookBetweenStat extends Command
-{
-    /**
-     * 执行命令   php artisan cp_generate_cp_book_between_stat 2018-10-01 2018-11-01
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'cp_generate_cp_book_between_stat {start_date} {end_date}';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = 'CP图书订阅指定时间区间数据生成';
-
-    /**
-     * Execute the console command.
-     * 注意:start_date <= 计算区间 <= end_date
-     * @return mixed
-     */
-    public function handle()
-    {
-        print_r("======CP图书订阅指定时间区间数据生成 【任务执行开始】=====" . date("y-m-d H:i:s" . "\n"));
-        Log::info("======CP图书订阅指定时间区间数据生成【任务执行开始】=====" . date("y-m-d H:i:s" . "\n"));
-        
-        $start_date = $this->argument('start_date');
-        $end_date = $this->argument('end_date');
-        if(empty($start_date) || empty($end_date)){
-        	Log::info('GenerateCpBookBetweenStat param null:start_date:'.$start_date.' end_date:'.$end_date);
-        }
-        $month = date('Y-m',strtotime($start_date));
-        $calculate_date = $end_date;
-        $end_date = date('Y-m-d',strtotime($end_date) - 24*3600);
-        Log::info('start_date:'.$start_date.' end_date:'.$end_date.' month:'.$month.' calculate_date:'.$calculate_date);
-
-        GenerateCpBookStatService::generateCpBookBetweenStat($start_date,$end_date,$month,$calculate_date);
-
-        Log::info("======CP图书订阅指定时间区间数据生成 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-        print_r("======CP图书订阅指定时间区间数据生成 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-    }
-}

+ 0 - 49
app/Console/Commands/CP/GenerateCpBookStat.php

@@ -1,49 +0,0 @@
-<?php
-/**
- * zhoulj
- * 2018-05-15
- */
-
-namespace App\Console\Commands\CP;
-
-use App\Modules\CP\Services\GenerateCpBookStatService;
-use Illuminate\Console\Command;
-use Log;
-
-class GenerateCpBookStat extends Command
-{
-    /**
-     * 执行命令   php artisan cp_generate_cp_book_stat
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'cp_generate_cp_book_stat';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '每日CP图书订阅数据生成';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        print_r("======每日CP图书订阅数据生成 【任务执行开始】=====" . date("y-m-d H:i:s" . "\n"));
-        Log::info("======每日CP图书订阅数据生成【任务执行开始】=====" . date("y-m-d H:i:s" . "\n"));
-
-        // 生成每日统计
-        $date = date("Y-m-d", strtotime('-1 day'));
-        GenerateCpBookStatService::generateCpBookDailyStat($date);
-        //GenerateCpBookStatService::generateCpBookDailyStat2('2018-12-09');
-
-        Log::info("======每日CP图书订阅数据生成 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-        print_r("======每日CP图书订阅数据生成 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-    }
-}

+ 0 - 42
app/Console/Commands/ChangePay.php

@@ -1,42 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use DB;
-class ChangePay extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'pay:change';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = 'Command description';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        //DB::table('distribution_channels')->whereIn('id',[5,123])->update(['pay_merchant_id'=>8]);
-    }
-}

+ 0 - 74
app/Console/Commands/Channel/CheckStatus.php

@@ -1,74 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: songdb
- * Date: 2017/12/26
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands\Channel;
-
-use App\Modules\Channel\Services\ChannelService;
-use App\Modules\SendOrder\Services\SendOrderService;
-use App\Modules\Channel\Services\ChannelUserService;
-
-use Log;
-use Illuminate\Console\Command;
-
-class CheckStatus extends Command
-{
-    /**
-     * 执行命令   php artisan generate_order_day_stat
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'channel_user_check_status';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '检测渠道账号状态';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        print_r("======检测渠道账号状态 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        Log::info("======检测渠道账号状态 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        $channel_users = ChannelUserService::getChannelList([],1);
-
-        if(count($channel_users))
-        {
-            $channel_users->each(function($channel_user) {
-                $channel_ids = ChannelService::getUserChannelIds($channel_user->id);
-
-                $total_send_order_num = 0;
-                foreach ($channel_ids as $channel_id)
-                {
-                    $distribution_channel_id = $channel_id;
-                    $total_send_order_num += (int)SendOrderService::getPromotionCount(compact('distribution_channel_id'));
-                }
-
-                $except_channel_user_ids = [235,321];
-                //判断是否有派单,并且注册时间大于15天  设置为待审核状态
-                if($total_send_order_num == 0 && time() - strtotime($channel_user->created_at) > 86400*15 && !in_array($channel_user->id,$except_channel_user_ids))
-                {
-                    ChannelUserService::updateChannelData($channel_user->id,['is_enabled'=>0]);
-                }
-
-            });
-        }
-
-        Log::info("======检测渠道账号状态 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-        print_r("======检测渠道账号状态 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-    }
-}

+ 0 - 72
app/Console/Commands/ChannelReaderVisitStats.php

@@ -1,72 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use App\Modules\Statistic\Services\WapVisitStatService;
-use DB;
-use Illuminate\Console\Command;
-use Redis;
-
-class ChannelReaderVisitStats extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'channel_reader_visit_stats';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = 'Command description';
-
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    public function handle()
-    {
-
-        /*$start_date = '2016-08-29';
-        $end_date =  date("Y-m-d", strtotime("-1 day"));
-        $end_timestamp = strtotime($end_date);
-        $start_timestamp = strtotime($start_date);
-
-        // 计算日期段内有多少天
-        $days = ($end_timestamp - $start_timestamp) / 86400 + 1;
-        for ($i = 0; $i < $days; $i++) {
-            $date = date('Y-m-d', $start_timestamp + (86400 * $i));
-            $this->getReadVisitUvInfo($date);
-        }
-
-        /*$yesterday = date("Y-m-d", strtotime("-1 day"));
-        $this->getReadVisitUvInfo($yesterday);*/
-
-        $yesterday = date("Y-m-d", strtotime("-1 day"));
-        $this->getReadVisitUvInfo($yesterday);
-    }
-
-    function getReadVisitUvInfo($date)
-    {
-        $channels = Redis::smembers(sprintf('recordReaderUvAndPv:date:%s', $date));
-        if ($channels) {
-            foreach ($channels as $channel) {
-                $data = WapVisitStatService::getReaderUvAndPv($channel, $date);
-                if ($data) {
-                    $uv = $data['uv'];
-                    $pv = $data['pv'];
-                    $distribution_channel_id = $channel;
-                    $created_at = date("Y-m-d H:i:s");
-                    $updated_at = date("Y-m-d H:i:s");
-                    $data = compact('date', 'uv', 'pv', 'created_at', 'updated_at', 'distribution_channel_id');
-                    DB::table('channel_reader_visit_stats')->insert($data);
-                }
-            }
-        }
-        WapVisitStatService::deleteReaderUvAndPvRedisKey($date);
-    }
-}

+ 0 - 66
app/Console/Commands/ChapterImageTask.php

@@ -1,66 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/20
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands;
-
-use App\Libs\ChapterToImage;
-use App\Modules\Book\Models\Book;
-use App\Modules\Book\Services\ChapterImageService;
-use Log;
-use Illuminate\Console\Command;
-
-class ChapterImageTask extends Command
-{
-    /**
-     * 执行命令   php artisan chapter_to_image_task
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'chapter_to_image_task';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '章节图片生成生成';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-
-        print_r("======章节图片生成生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        Log::info("======章节图片生成生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-
-        $books = Book::select('id')->orderBy('id')->get();
-        foreach ($books as $book) {
-            $cimages = ChapterImageService::getChapterImage($book['id']);
-            if(empty($cimages) || sizeof($cimages) == 0) {
-
-                ChapterToImage::createChapterImage($book['id']);
-                print_r($book['id']."       ".date("y-m-d H:i:s")."\n");
-                Log::info($book['id']."       ".date("y-m-d H:i:s"."\n"));
-                sleep(1);
-            } else {
-
-                print_r("已经生成图片: ".$book['id']."       ".date("y-m-d H:i:s")."\n");
-            }
-
-        }
-
-        Log::info("======章节图片生成生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-        print_r("======章节图片生成生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-    }
-}

+ 0 - 152
app/Console/Commands/ChapterOrderTotal.php

@@ -1,152 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use DB;
-use Redis;
-use Log;
-class ChapterOrderTotal extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'book:cot {--type=}';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '更新章节订购统计';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $option = $this->option('type');
-        if(!$option){
-            $this->sub1();
-        }
-        if($option == 'cp'){
-            $this->cpChargeAndReward();
-            //$this->cpData();
-        }
-        if($option == 'order'){
-            $this->orderDayStat();
-            //$this->orderDayStatAll();
-        }
-    }
-
-
-    public function sub1(){
-        $start = date('Y-m-d',time()-86400);
-        $end = date('Y-m-d');
-        $sql = 'call cp_data_temp("'.$start.'","'.$end.'");';
-        DB::connection('chapter_order_mysql')->select($sql);
-        $bids = DB::table('book_configs')->select('bid')->get();
-        $data = [];
-        $day = date('Y--m-d',time()-86400);
-        foreach ($bids as $book){
-            $fee = Redis::hget('wap:chapterandbookorder:bid:'.$book->bid,$day);
-            if(!$fee) $fee = 0;
-            $data[] = ['bid'=>$book->bid,'day'=>$day,'fee'=>$fee,'created_at'=>date('Y-m-d H:i:s'),'updated_at'=>date('Y-m-d H:i:s')];
-            Redis::hdel('wap:chapterandbookorder:bid:'.$book->bid,$day);
-        }
-        DB::table('book_order_statistical')->insert($data);
-        $end2 = $start.' 23:59:59';
-
-        $sql2 = 'call chapter_orders("'.$start.'","'.$end2.'");';
-        DB::connection('chapter_order_mysql')->select($sql2);
-    }
-
-    public function cpData(){
-        $sql = "select bid,date,sum(sum_charge_balance) as sum_charge_balance, sum(sum_reward_balance) as sum_reward_balance from sub_bak5 GROUP by bid,date";
-        $chapter = DB::connection('chapter_order_mysql')->select($sql);
-        Log::info($chapter);
-        foreach ($chapter as $v){
-            DB::table('book_order_statistical')->where('bid',$v->bid)->where('day',$v->date)->update(['charge_balance'=>(int)$v->sum_charge_balance,'reward_balance'=>(int)$v->sum_reward_balance]);
-            $v = null;
-        }
-        $sql = "select bid,date(created_at) as date,sum(charge_balance) as sum_charge_balance ,sum(reward_balance) as sum_reward_balance from book_orders GROUP by bid,date(created_at)";
-        $book = DB::select($sql);
-        foreach ($book as $v){
-            DB::table('book_order_statistical')->where('bid',$v->bid)->where('day',$v->date)->increment('charge_balance',(int)$v->sum_charge_balance);
-            DB::table('book_order_statistical')->where('bid',$v->bid)->where('day',$v->date)->increment('reward_balance',(int)$v->sum_reward_balance);
-        }
-    }
-
-    public function cpChargeAndReward(){
-        $date = date('Y-m-d',time()-86400);
-        $sql_format = "select bid,date(created_at) as date,sum(charge_balance) as sum_charge_balance ,sum(reward_balance) as sum_reward_balance from book_orders where date(created_at)='%s' GROUP by bid,date(created_at)";
-        echo sprintf($sql_format,$date);
-        $book = DB::select(sprintf($sql_format,$date));
-        foreach ($book as $v){
-            DB::table('book_order_statistical')->where('bid',$v->bid)->where('day',$v->date)->increment('charge_balance',(int)$v->sum_charge_balance);
-            DB::table('book_order_statistical')->where('bid',$v->bid)->where('day',$v->date)->increment('reward_balance',(int)$v->sum_reward_balance);
-        }
-
-        $sql = "select bid,date,sum(sum_charge_balance) as sum_charge_balance, sum(sum_reward_balance) as sum_reward_balance from sub_bak5 where date='%s'  GROUP by bid,date";
-        $chapter = DB::connection('chapter_order_mysql')->select(sprintf($sql,$date));
-        foreach ($chapter as $v){
-            DB::table('book_order_statistical')->where('bid',$v->bid)->where('day',$v->date)->increment('charge_balance',(int)$v->sum_charge_balance);
-            DB::table('book_order_statistical')->where('bid',$v->bid)->where('day',$v->date)->increment('reward_balance',(int)$v->sum_reward_balance);
-        }
-    }
-
-    public function orderDayStatAll(){
-        DB::table('order_day_stats')->select('id', 'distribution_channel_id', 'date')->orderBy('id')->chunk(1000, function ($res) {
-            foreach ($res as $v) {
-                $chapter_sql = "select sum(sum_fee) as sum_fee,sum(sum_charge_balance) as sum_charge_balance,sum(sum_reward_balance) as sum_reward_balance from sub_bak5 where distribution_channel_id=%s and date='%s'";
-                $chapter_data = DB::connection('chapter_order_mysql')->select(sprintf($chapter_sql,$v->distribution_channel_id,$v->date));
-                DB::table('send_orders_stats')->where('id',$v->id)->update([
-                    'fee'=>(int)$chapter_data[0]->sum_fee,
-                    'charge_balance'=>(int)$chapter_data[0]->sum_charge_balance,
-                    'reward_balance'=>(int)$chapter_data[0]->sum_reward_balance,
-                    ]);
-
-                $end_date = date('Y-m-d',strtotime($v->date)+86400);
-                $book_sql = "select sum(fee) as sum_fee,sum(charge_balance) as sum_charge_balance,sum(reward_balance) as sum_reward_balance from book_orders where distribution_channel_id=%s and created_at >='{$v->date}' and created_at < '{$end_date}'";
-                $chapter_data = DB::select($book_sql);
-
-                $update_sql = "update send_orders_stats set sum_fee=sum_fee+".(int)$chapter_data[0]->sum_fee.',sum_charge_balance=sum_charge_balance+'.(int)$chapter_data[0]->sum_charge_balance.',sum_reward_balance=sum_reward_balance+'.(int)$chapter_data[0]->sum_reward_balance.' where id='.$v->id;
-                DB::update($update_sql);
-            }
-        });
-    }
-
-    public function orderDayStat(){
-        DB::table('order_day_stats')->select('id', 'distribution_channel_id', 'date')->where('date',date('Y-m-d',time()-86400))->orderBy('id')->chunk(1000, function ($res) {
-            foreach ($res as $v) {
-                $chapter_sql = "select sum(sum_fee) as sum_fee,sum(sum_charge_balance) as sum_charge_balance,sum(sum_reward_balance) as sum_reward_balance from sub_bak5 where distribution_channel_id=%s and date='%s'";
-                $chapter_data = DB::connection('chapter_order_mysql')->select(sprintf($chapter_sql,$v->distribution_channel_id,$v->date));
-
-                $update_sql = "update send_orders_stats set sum_fee=sum_fee+".(int)$chapter_data[0]->sum_fee.',sum_charge_balance=sum_charge_balance+'.(int)$chapter_data[0]->sum_charge_balance.',sum_reward_balance=sum_reward_balance+'.(int)$chapter_data[0]->sum_reward_balance.' where id='.$v->id;
-                DB::update($update_sql);
-
-                $end_date = date('Y-m-d',strtotime($v->date)+86400);
-                $book_sql = "select sum(fee) as sum_fee,sum(charge_balance) as sum_charge_balance,sum(reward_balance) as sum_reward_balance from book_orders where distribution_channel_id={$v->distribution_channel_id} and created_at >='{$v->date}' and created_at < '{$end_date}'";
-                $chapter_data = DB::select($book_sql);
-
-                $update_sql = "update send_orders_stats set sum_fee=sum_fee+".(int)$chapter_data[0]->sum_fee.',sum_charge_balance=sum_charge_balance+'.(int)$chapter_data[0]->sum_charge_balance.',sum_reward_balance=sum_reward_balance+'.(int)$chapter_data[0]->sum_reward_balance.' where id='.$v->id;
-                DB::update($update_sql);
-            }
-        });
-    }
-
-}

+ 0 - 75
app/Console/Commands/ChargeTemplateStat.php

@@ -1,75 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/20
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands;
-
-use App\Modules\Trade\Services\OrderService;
-use DB;
-use Illuminate\Console\Command;
-use Log;
-
-class ChargeTemplateStat extends Command
-{
-    /**
-     * 执行命令   php artisan bill_task
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'charge_template_stat';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '充值模板数据统计';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $book_id = '1148';
-        $distribution_channel_id = 123;
-        $book_name = '婚情告急:总裁请别撩';
-        $users = DB::table('user_first_visit_pay_page')->limit(12000)->get();
-        foreach ($users as $userItem) {
-            $uid = $userItem->uid;
-            $created_at = $userItem->created_at;
-            $created_at_timestamp = strtotime($created_at);
-            $params = ['uid' => $uid, 'begin_time' => $created_at, 'end_time' => date('Y-m-d H:i:s', $created_at_timestamp + 86400)];
-            $recharge_amount_in_24h = OrderService::getAmount($params);
-
-            $params = ['uid' => $uid, 'begin_time' => $created_at, 'end_time' => date('Y-m-d H:i:s', $created_at_timestamp + 86400 * 3)];
-            $recharge_amount_in_72h = OrderService::getAmount($params);
-
-            $params = ['uid' => $uid, 'begin_time' => $created_at, 'end_time' => date('Y-m-d H:i:s', $created_at_timestamp + 86400 * 7)];
-            $recharge_amount_in_7d = OrderService::getAmount($params);
-
-            $params = ['uid' => $uid, 'begin_time' => $created_at, 'end_time' => date('Y-m-d H:i:s', $created_at_timestamp + 86400 * 30)];
-            $recharge_amount_in_30d = OrderService::getAmount($params);
-
-            $params = ['uid' => $uid];
-            $recharge_amount = OrderService::getAmount($params);
-
-            $template_type = $userItem->template_type;
-
-            $data = ['uid' => $uid, 'book_id' => $book_id, 'book_name' => $book_name, 'template_tye' => $template_type,
-                'distribution_channel_id' => $distribution_channel_id, 'recharge_amount_in_24h' => $recharge_amount_in_24h,
-                'recharge_amount_in_72h' => $recharge_amount_in_72h, 'recharge_amount_in_7d' => $recharge_amount_in_7d,
-                'recharge_amount_in_30d' => $recharge_amount_in_30d, 'recharge_amount' => $recharge_amount,
-                'created_at' => $created_at];
-            DB::table('charge_template_stat')->insert($data);
-        }
-        DB::update("UPDATE charge_template_stat a join users b on  a.uid=b.id set a.distribution_channel_id=b.distribution_channel_id");
-    }
-}

+ 0 - 47
app/Console/Commands/CheckAndSend.php

@@ -1,47 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use App\Modules\OfficialAccount\Services\TemplateCustomSendService;
-class CheckAndSend extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'CheckAndSend';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = 'Command description';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $this->start();
-    }
-    private function start(){
-        TemplateCustomSendService::toCheckAndSendTemplateMsg();
-
-        TemplateCustomSendService::toCheckAndSendCustomMsg();
-    }
-}

+ 0 - 106
app/Console/Commands/CheckBookCover.php

@@ -1,106 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/20
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands;
-
-use App\Modules\Book\Models\BookConfig;
-use App\Modules\Statistic\Services\SendStatsEmailService;
-use GuzzleHttp\Client;
-use Illuminate\Console\Command;
-use Log;
-
-class CheckBookCover extends Command
-{
-    /**
-     * 执行命令 检查图书封面
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'check_book_cover_status';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '检查图书封面';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        Log::info('CheckBookCover start command');
-        $this->loadBookCoverInfo();
-        Log::info('CheckBookCover end command');
-    }
-
-    function loadBookCoverInfo()
-    {
-        $pageCount = 0; //当前的页数(默认从0开始)
-        $pageSize = 200;//每页的条数
-        $totalCount = BookConfig::getBooksCount(); //总条数
-        $totalPageCount = Ceil($totalCount / $pageSize); ////总页数
-        Log::info('CheckBookCover totalCount is  ' . $totalCount);
-        Log::info('CheckBookCover totalPageCount is  ' . $totalPageCount);
-        $errorBookCoverArray = [];
-        $client = new Client(['timeout' => 3.0,]);
-        while ($pageCount < $totalPageCount) {
-            Log::info('CheckBookCover currentPageCount is: ' . $pageCount);
-            $books = BookConfig::getBookCoverInfos(false, $pageSize, $pageCount);
-            foreach ($books as $bookItem) {
-                $coverUrl = $bookItem->cover;
-                try {
-                    $response = $client->request('get', $coverUrl);
-                    $resultCode = $response->getStatusCode();
-                    //成功
-                    if ($resultCode == 200 || $resultCode == 302) {
-
-                    } else {
-                        Log::info('CheckBookCover load error');
-                        $errorBookCoverArray[] = $bookItem;
-                    }
-                } catch (\Exception $e) {
-                    Log::info('CheckBookCover load error');
-                    $errorBookCoverArray[] = $bookItem;
-                }
-            }
-            $pageCount++;
-        }
-
-        if ($errorBookCoverArray) {
-            Log::info('CheckBookCover need sendEmail');
-            $this->sendEmail($errorBookCoverArray);
-        } else {
-            Log::info('CheckBookCover not need sendEmail');
-        }
-    }
-
-    function sendEmail($errorBookCoverArray)
-    {
-        Log::info('CheckBookCover start sendEmail');
-        $to_user = array(
-            ['address' => 'zhangzg@iqiyoo.com', 'name' => '张总'],
-            ['address' => 'songdb@iqiyoo.com', 'name' => 'songdb'],
-            ['address' => 'liur@iqiyoo.com', 'name' => '刘嵘'],
-            ['address' => 'sijj@yqsd.net', 'name' => 'sijj'],
-            ['address' => 'qincp@iqiyoo.com', 'name' => '阿才'],
-        );
-
-        $content = "<table border='1' cellpadding='10' cellspacing='0'><tr><td align='center'>id</td><td align='center'>书名</td><td align='center'>作者</td></tr>";
-        foreach ($errorBookCoverArray as $item) {
-            $content .= "<tr><td align='center'>{$item->bid}</td><td align='center'>{$item->book_name}</td><td align='center'>{$item->author}</td></tr>";
-        }
-        $content .= "</table>";
-        SendStatsEmailService::SendHtmlEmailWithAcce($to_user, ['subject' => date("Y-m-d", time()) . "追书云错误封面的书籍信息", 'body' => $content]);
-    }
-}

+ 0 - 47
app/Console/Commands/CheckOfficialAccountTemplate.php

@@ -1,47 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use App\Http\Controllers\Manage\OfficialAccount\WeChatToolsController;
-class CheckOfficialAccountTemplate extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'CheckOfficialAccountTemplate';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '检查公众号模板';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $this->CheckOfficialAccountTemplate();
-    }
-
-    public function CheckOfficialAccountTemplate(){
-    	$weChatToolsController = new WeChatToolsController();
-        $weChatToolsController->check_official_account_templates();
-    }
-}

+ 0 - 190
app/Console/Commands/CheckSiteStatus.php

@@ -1,190 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/20
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands;
-
-use App\Modules\Statistic\Services\SendStatsEmailService;
-use DB;
-use GuzzleHttp\Client;
-use Illuminate\Console\Command;
-use Log;
-
-class CheckSiteStatus extends Command
-{
-    /**
-     * 执行命令 检查站点信息
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'check_site_status';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '检查掌中云站点信息';
-
-    public $table_name = 'novel_platform_sites';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        Log::info('CheckSiteStatus start command');
-        $this->loadSiteIndexInfo();
-        //$this->loadCompanyName();
-        Log::info('CheckSiteStatus end command');
-    }
-
-    function loadCompanyName()
-    {
-        $pageCount = 0;
-        $pageSize = 1000;
-        $client = new Client(['timeout' => 3.0,]);
-        $totalCount = DB::table($this->table_name)->max('site');
-        $totalPageCount = ceil($totalCount / $pageSize);
-        while ($pageCount < $totalPageCount) {
-            $beginIndex = $pageCount * $pageSize;
-            $data = DB::table($this->table_name)->offset($beginIndex)->limit($pageSize)->get();
-            if ($data) {
-                foreach ($data as $item) {
-                    $gzh_name = trim($item->gzh_name);
-                    $companyInfo = $this->getCompanyInfo($client, $gzh_name);
-                    $companyInfo['updated_at'] = date("Y-m-d H:i:s");
-                    DB::table($this->table_name)->where('id', $item->id)->update($companyInfo);
-                    sleep(1);
-                }
-            }
-            $pageCount++;
-        }
-    }
-
-    function loadSiteIndexInfo()
-    {
-        $trueSiteArray = [];
-        $client = new Client(['timeout' => 3.0,]);
-        $lastIndex = DB::table('novel_platform_sites')->max('site');
-        $index = $lastIndex + 1;
-        while ($index <= $lastIndex + 1000) {
-            Log::info('check_site_status index is: ' . $index);
-            $siteUrl = 'https://c' . $index . '.818tu.com/spa/config?tdsourcetag=s_pcqq_aiomsg';
-            Log::info('check_site_status siteUrl is: ' . $siteUrl);
-            try {
-                $response = $client->request('get', $siteUrl);
-                $resultCode = $response->getStatusCode();
-                //成功
-                if ($resultCode == 200 || $resultCode == 302) {
-                    $content = $response->getBody()->getContents();
-                    //Log::info('content is :' . $content);
-                    if ($content) {
-                        $findStr = "mp:";
-                        $findBegin = strpos($content, $findStr);
-                        if ($findBegin) {
-                            $findBegin = $findBegin + strlen($findStr);
-                            $findEnd = strpos($content, '},', $findBegin);
-                            if ($findEnd) {
-                                $content = substr($content, $findBegin, $findEnd - $findBegin + 1);
-                                Log::info('content is :' . $content);
-                                $content = json_decode($content);
-                                $gzh_name = trim($content->raw_id);
-                                $companyInfo = $this->getCompanyInfo($client, $gzh_name);
-                                $params = [
-                                    'site' => $index,
-                                    'gzh_name' => $gzh_name,
-                                    'platform_name' => '掌中云',
-                                    'appid' => $content->app_id,
-                                    'nickname' => $content->nickname,
-                                    'qrcode' => $companyInfo['qrcode'],
-                                    'company' => $companyInfo['company'],
-                                    'created_at' => date("Y-m-d H:i:s"),
-                                    'updated_at' => date("Y-m-d H:i:s"),
-                                    'fans_num_estimate' => $companyInfo['fans_num_estimate']
-                                ];
-                                $trueSiteArray[] = $params;
-                                DB::table('novel_platform_sites')->insert($params);
-                            }
-                        }
-                    } else {
-                        Log::info('content is :' . $content);
-                    }
-                } else {
-                    Log::info('CheckSiteStatus load error resultCode is:' . $resultCode);
-                }
-            } catch (\Exception $e) {
-                Log::info('CheckSiteStatus load error');
-                Log::info($e->getMessage());
-            }
-            $index++;
-        }
-
-        if ($trueSiteArray) {
-            Log::info('CheckSiteStatus need sendEmail');
-            $this->sendEmail($trueSiteArray);
-        } else {
-            Log::info('CheckSiteStatus not need sendEmail');
-        }
-    }
-
-    function getCompanyInfo($client, $gzh_name)
-    {
-        $qrcode = '';
-        $company = '';
-        $fans_num_estimate = '';
-        $time_stamp = time();
-        $sign_params = 'app_id=364c32166857f0131a0ac35396d6c0&kw=' . $gzh_name . '&page=1&timestamp=' . $time_stamp;
-        $sign = md5($sign_params . 'sjadf92jf9vh@827*sjfo09n30');
-        $url = 'https://api.wxb.com/data/search?' . $sign_params . '&sign=' . $sign;
-        try {
-            $response = $client->request('get', $url);
-        } catch (\Exception $e) {
-            Log::info($e->getMessage());
-            return compact('qrcode', 'company', 'fans_num_estimate');
-        }
-
-        $resultCode = $response->getStatusCode();
-        if ($resultCode == 200 || $resultCode == 302) {
-            $content = $response->getBody()->getContents();
-            $content = json_decode($content);
-            $content = $content->data;
-            if (is_array($content) && count($content) > 0) {
-                $content = $content[0];
-                $qrcode = $content->qrcode;
-                $company = $content->company;
-                $fans_num_estimate = $content->fans_num_estimate;
-            }
-        }
-        return compact('qrcode', 'company', 'fans_num_estimate');
-    }
-
-    function sendEmail($trueSiteArray)
-    {
-        Log::info('CheckSiteStatus start sendEmail');
-        $to_user = array(
-            ['address' => 'zhangzg@iqiyoo.com', 'name' => '张总'],
-            ['address' => 'songdb@iqiyoo.com', 'name' => 'songdb'],
-            ['address' => 'zhaojp@yqsd.net', 'name' => '赵君平'],
-            ['address' => 'sijj@yqsd.net', 'name' => 'sijj'],
-            ['address' => 'qincp@iqiyoo.com', 'name' => '阿才'],
-        );
-
-        $content = "<table border='1' cellpadding='10' cellspacing='0'><tr><td align='center'>序号</td><td align='center'>站点id</td><td align='center'>公众号名称</td><td align='center'>主体公司名称</td></tr>";
-        $index = 0;
-        foreach ($trueSiteArray as $item) {
-            $index++;
-            $content .= "<tr><td align='center'>{$index}</td><td align='center'>{$item['site']}</td><td align='center'>{$item['nickname']}</td><td align='center'>{$item['company']}</td></tr>";
-        }
-        $content .= "</table>";
-        SendStatsEmailService::SendHtmlEmailWithAcce($to_user, ['subject' => date("Y-m-d", time()) . "掌中云昨天新增站点" . $index . "个", 'body' => $content]);
-    }
-}

+ 0 - 126
app/Console/Commands/CheckZhangDuSiteStatus.php

@@ -1,126 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/20
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands;
-
-use App\Modules\Statistic\Services\SendStatsEmailService;
-use DB;
-use GuzzleHttp\Client;
-use Illuminate\Console\Command;
-use Log;
-
-/**
- * 检测掌读的站点信息
- * Class CheckZhangDuSiteStatus
- * @package App\Console\Commands
- */
-class CheckZhangDuSiteStatus extends Command
-{
-    /**
-     * 执行命令 检测掌读的站点信息
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'check_zhang_du_site_status';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '检测掌读的站点信息';
-
-    public $tag = 'check_zhang_du_site_status';
-    public $table_name = 'novel_platform_sites_zhangdu';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        Log::info($this->tag . 'start command');
-        $this->loadSiteIndexInfo();
-        Log::info($this->tag . 'end command');
-    }
-
-    function loadSiteIndexInfo()
-    {
-        $client = new Client(['timeout' => 3.0,]);
-        $top_site_arr = ['.com', '.cn', '.net'];
-        $results = [];
-        $count = 0;
-        $header = ['User-Agent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/16A404 MicroMessenger/6.7.4(0x1607042c) NetType/WIFI Language/zh_CN'];
-
-        $lastIndex = DB::table($this->table_name)->max('site');
-        $index = $lastIndex + 1;
-        while ($index <= $lastIndex + 1000) {
-            foreach ($top_site_arr as $item) {
-                try {
-                    $request_url = 'https://s' . $index . '.zhangdu520' . $item;
-                    $response = $client->request('get', $request_url, [
-                        'headers' => $header,
-                        'curl' => [
-                            CURLOPT_SSL_VERIFYPEER => false
-                        ]
-                    ]);
-                    $resultCode = $response->getStatusCode();
-                    if ($resultCode == 200 || $resultCode == 302) {
-                        $count++;
-                        $results[] = ['url' => $request_url, 'site' => $index];
-                        $this->saveToDB($index, $request_url);
-                        break;
-                    }
-                } catch (\Exception $e) {
-                    Log::info($e->getMessage());
-                }
-            }
-            if ($index % 10000 == 0) print_r($index);
-            $index++;
-        }
-
-        if ($results && count($results) > 0) {
-            $this->sendEmail($results);
-        }
-    }
-
-    function saveToDB($site, $url)
-    {
-        $params = [
-            'url' => $url,
-            'site' => $site,
-            'platform_name' => '掌读',
-            'created_at' => date("Y-m-d H:i:s"),
-            'updated_at' => date("Y-m-d H:i:s")];
-        DB::table($this->table_name)->insert($params);
-    }
-
-    function sendEmail($results)
-    {
-        Log::info($this->tag . ' start sendEmail');
-        $to_user = array(
-            ['address' => 'zhangzg@iqiyoo.com', 'name' => '张总'],
-            ['address' => 'zhaojp@yqsd.net', 'name' => '赵君平'],
-            ['address' => 'songdb@iqiyoo.com', 'name' => 'songdb'],
-            ['address' => 'sijj@yqsd.net', 'name' => 'sijj'],
-            ['address' => 'qincp@iqiyoo.com', 'name' => '阿才'],
-        );
-
-        $content = "<table border='1' cellpadding='10' cellspacing='0'><tr><td align='center'>序号</td><td align='center'>站点id</td><td align='center'>访问的url</td></tr>";
-        $index = 0;
-        foreach ($results as $item) {
-            $index++;
-            $content .= "<tr><td align='center'>{$index}</td><td align='center'>{$item['site']}</td><td align='center'>{$item['url']}</td></tr>";
-        }
-        $content .= "</table>";
-        SendStatsEmailService::SendHtmlEmailWithAcce($to_user, ['subject' => date("Y-m-d", time()) . "掌读昨天新增站点" . $index . "个", 'body' => $content]);
-    }
-}

+ 0 - 46
app/Console/Commands/CustomSignPush.php

@@ -1,46 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use App\Modules\OfficialAccount\Services\CustomMsgService;
-class CustomSignPush extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'CustomSignPush';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '签到智能推送';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $this->customSignPush();
-    }
-
-    public function customSignPush(){
-        CustomMsgService::SmartPush('sign_push');
-    }
-}

+ 0 - 46
app/Console/Commands/CustomSubscribePush.php

@@ -1,46 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use App\Modules\OfficialAccount\Services\CustomMsgService;
-class CustomSubscribePush extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'CustomSubscribePush';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '关注智能推送';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $this->customSubscribePush();
-    }
-
-    public function customSubscribePush(){
-        CustomMsgService::SmartPush('subscribe_push');
-    }
-}

+ 0 - 61
app/Console/Commands/DistributionStats/WeeklyDailyStats.php

@@ -1,61 +0,0 @@
-<?php
-/**
- 渠道周报数据
- */
-
-namespace App\Console\Commands\DistributionStats;
-
-use Log;
-use Illuminate\Console\Command;
-use App\Modules\OfficialAccount\Models\TempForceSubscribeUsers;
-use App\Modules\OfficialAccount\Services\MsgService;
-use App\Modules\SendOrder\Services\SendOrderStatisticsService;
-use App\Modules\Channel\Models\Channel;
-use DB;
-
-class WeeklyDailyStats extends Command
-{
-    /**
-     * 执行命令  WeeklyDailyStats 123
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'WeeklyDailyStats {channel_id}';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '维护渠道周报数据';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        ini_set('memory_limit', '1024M');
-        print_r('memory_used:'.memory_get_usage()."\n");
-        print_r("======维护渠道周报数据【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        $distribution_channel_id = $this->argument('channel_id');
-        if($distribution_channel_id != 'all'){
-       		\Log::info('start_getWeeklySendOrderStatistics:'.$distribution_channel_id);
-        	SendOrderStatisticsService::getWeeklySendOrderStatistics($distribution_channel_id);
-        }else{
-        	$distribution_channels = Channel::getAllChannels();
-        	// 渠道列表
-        	foreach($distribution_channels as $distribution_channel){
-        		$distribution_channel_id = $distribution_channel->id;
-        		\Log::info('start_getWeeklySendOrderStatistics:'.$distribution_channel_id);
-        		SendOrderStatisticsService::getWeeklySendOrderStatistics($distribution_channel_id);
-        	}
-        }
-        
-        print_r("======维护渠道周报数据 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-        print_r('memory_used:'.memory_get_usage()."\n");
-    }
-}

+ 0 - 59
app/Console/Commands/DownPic.php

@@ -1,59 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/24
- * Time: 上午11:48
- */
-
-namespace App\Console\Commands;
-
-use Log;
-use App\Modules\Finance\Models\Bill;
-use GuzzleHttp;
-use Illuminate\Console\Command;
-use Storage;
-
-class DownPic extends Command
-{
-
-
-    /**
-     * 执行命令   php artisan bill_task
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'down_pic';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '下载图片';
-
-
-    public function handle() {
-        $client = new GuzzleHttp\Client();
-
-        $fp  = fopen(storage_path("app/abc.txt"), 'r');
-        $str = fread($fp,filesize(storage_path("app/abc.txt")));
-        $arraylist= explode("\n",$str);
-        for($i=0;$i<count($arraylist);$i++) //把它们全部输出来
-        {
-            if(!empty($arraylist[$i])) {
-                echo $arraylist[$i]."     \n";
-                $data = $client->request('GET', $arraylist[$i])->getBody()->getContents();
-                $filename = str_replace("http://cdn-novel.weituibao.com/", "", $arraylist[$i]);
-                echo $filename."     \n";
-
-                Storage::disk('local')->put($filename, $data);
-            }
-        }
-    }
-
-
-
-}

+ 0 - 214
app/Console/Commands/FailOrderAlert.php

@@ -1,214 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use App\Modules\Subscribe\Services\OrderService;
-use Redis;
-use App\Libs\SMS;
-use Log;
-use DB;
-use App\Jobs\SendTexts;
-class FailOrderAlert extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'foa {--qrcode}';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '失败订单预警';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $options = $this->option('qrcode');
-        if($options){
-            return $this->forceSubscribeErrorAlert();
-        } else{
-            $this->tooLongNoOrderAlert();
-            return  $this->start();
-
-        }
-    }
-
-    private function start(){
-        if(!$this->isCanAlert()) return 1;
-        $sorce = $this->getPaySource();
-        if(!$sorce){
-            return false;
-        }
-        foreach ($sorce as $v){
-            $is_all_fail= $this->isAllFail($v->source);
-            $too_long = $this->lastOrderTooLong();
-            $content = '';
-            if($is_all_fail){
-                $content = '订单预警,'.$v->source.'通道最近20个订单都是未支付订单,尽快排查';
-            }
-
-            if($too_long){
-                $content = $v->source.'通道最近半小时没有产生一条订单,尽快排查';
-            }
-            if(!$content) return 2;
-
-            $phone_arr = ['15868100210','18072713392','15088790066','13858057394','18668029091','18668420256'];
-            //$phone_arr = ['18668029091'];
-            foreach ($phone_arr as $phone){
-                $this->sendAndRecord(1,$phone,$content);
-            }
-            $key = 'distribution_channel_id:orderalert';
-            $field = 'sendalert';
-            Redis::hset($key,$field,time());
-        }
-
-        return 3;
-
-    }
-
-    private function forceSubscribeErrorAlert(){
-        $errors = Redis::SMEMBERS('force_subscribe_qrcode:error');
-        if(!$errors){
-            return false;
-        }
-
-        $res = [];
-        foreach ($errors as $value){
-            $temp = explode('_',$value);
-            $res[$temp[0]][] = $temp[1];
-        }
-        $phone_arr = ['15868100210','18072713392','15088790066','13858057394','18668029091','18668420256'];
-        //$phone_arr = ['18668029091'];
-        if($res){
-            foreach ($res as $k=>$v){
-                if(count($v) >= 5){
-                    $content = 'appid='.$k.'的公众号获取强关二维码出问题了!!,一分钟之内出现'.count($v).'次';
-                    foreach ($phone_arr as $phone){
-                        SMS::send($phone,$content);
-                    }
-                    //break;
-                }
-            }
-        }
-        Redis::srem('force_subscribe_qrcode:error',$errors);
-        return false;
-    }
-
-    private  function tooLongNoOrderAlert(){
-        $last = DB::table('orders')->orderBy('id','desc')->first();
-        if(time()-strtotime($last->created_at) >= 150){
-            $phone_arr = ['15868100210','18072713392','15088790066','13858057394','18668029091','18668420256'];
-            //$phone_arr = ['18668029091'];
-            $content = '订单预警,最近两分半没有产生一条订单,尽快排查';
-            foreach ($phone_arr as $phone){
-                echo SMS::send($phone,$content);
-            }
-        }
-    }
-
-    private function getAllChannel(){
-        return OrderService::getAllChannelId();
-    }
-
-    private function getPaySource(){
-        $sql = 'select distinct pay_merchant_id from distribution_channels where pay_merchant_id <>0';
-        $res = DB::select($sql);
-        $id_array = [];
-        if($res){
-            foreach ($res as $v){
-                $id_array[] = $v->pay_merchant_id;
-            }
-        }
-        $ssql = 'select distinct source from pay_merchants where id in('.implode(',',$id_array).')';
-        $source = DB::select($ssql);;
-        return $source;
-    }
-    /**
-     * 最近20订单是否全部失败
-     * @param $channel
-     * @param int $num
-     * @return bool
-     */
-    private  function isAllFail($source,$num=20){
-        $order = OrderService::getLatestOrderByChannleId($source,$num);
-
-        if(!$order)  return false;
-        if($order && count($order) < $num){
-            return false;
-        }
-        foreach ($order as $val){
-            if($val->status == 'PAID'){
-                return false;
-            }
-
-        }
-        return true;
-    }
-
-    /**
-     * 最后一条订单距离现在是否超过半小时
-     * @return bool
-     */
-    private function lastOrderTooLong(){
-        $order = OrderService::getLastOrder();
-        if(time()-strtotime($order->created_at) > 1800){
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * 是否可以发送预警
-     * @param $channel
-     * @return bool
-     */
-    private function isCanAlert(){
-        $key = 'distribution_channel_id:orderalert';
-        $field = 'sendalert';
-        $res = Redis::hget($key,$field);
-        if($res && (time()-$res) < 1800 ){
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * 发送预警,并记录
-     * @param $channel_info
-     * @param $content
-     * @return bool
-     */
-    private function sendAndRecord($channel,$phone,$content){
-        if(empty($phone)){
-            return false;
-        }
-        $status = SMS::send($phone,$content);
-
-        $record = json_encode([
-            'phone'=>$phone,
-            'status'=>$status,
-            'time'=>time()
-        ]);
-        $key = 'distribution_channel_id:orderalert:record';
-        Redis::rpush($key,$record);
-    }
-}

+ 0 - 46
app/Console/Commands/ForBiddenOfficialAccountRemind.php

@@ -1,46 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use App\Modules\OfficialAccount\Services\OfficialAccountService;
-class ForBiddenOfficialAccountRemind extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'ForBiddenOfficialAccountRemind';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = 'ForBiddenOfficialAccountRemind';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $this->start();
-    }
-
-    public function start(){
-        OfficialAccountService::check_gzh_ban();
-    }
-}

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 263
app/Console/Commands/ForceUserActive.php


+ 0 - 241
app/Console/Commands/ForceUserActive.php.bak

@@ -1,241 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/20
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands;
-
-use App\Modules\Finance\Services\FinanceService;
-use Log;
-use Illuminate\Console\Command;
-use DB;
-use Redis;
-use App\Modules\Book\Services\BookSubscribleChapterService;
-
-class ForceUserActive extends Command
-{
-    /**
-     * 执行命令   php artisan force_user_active
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'force_user_active';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '每日强关用户行为';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        /**
-         * 更新渠道、公众号信息
-         * update force_users_date_actives,distribution_channels,official_accounts set force_users_date_actives.distribution_channel_id = distribution_channels.id,force_users_date_actives.distribution_channel_name=distribution_channels.nickname,force_users_date_actives.gzh_name = official_accounts.nickname  where force_users_date_actives.appid = official_accounts.appid and official_accounts.distribution_channel_id = distribution_channels.id
-         * select date,distribution_channel_name,gzh_name,distribution_channel_id,fans_num,pay_user_num_in_one_day,unsub_user_num_in_one_day,unsub_in_one_day_read_last_free_user_num,pay_user_num_in_three_days,unsub_user_num_in_two_days,unsub_in_two_day_read_last_free_user_num,unsub_user_num_in_three_days,unsub_in_three_day_read_last_free_user_num,pay_user_num_in_one_month,order_sum_in_one_day,order_sum_in_three_day,order_sum_in_one_month from force_users_date_actives
-         * 24小时内取关粉丝阅读到免费最后一章和取关时间差
-         *select count(1) from force_users_date_read where is_unsub_in_one_day = 1 and  last_free_read_time is not null and unsub_time - last_free_read_time >10800 and unsub_time - last_free_read_time <=10800
-         *24小时内取关粉丝关注到取关时间差
-         *select count(1) from force_users_date_read where is_unsub_in_one_day = 1 and  unsub_time - sub_time >43200 and unsub_time - sub_time <=86400
-         *24小时内新关粉丝阅读到免费最后一章和首充时间差
-         *select count(1) from force_users_date_read where last_free_read_time is not null  and recharge_time_in_one_day is not null and  recharge_time_in_one_day - last_free_read_time >10800 and recharge_time_in_one_day - last_free_read_time <=10800
-         *24小时内新关粉丝关注到首充时间差
-         *select count(1) from force_users_date_read where recharge_time_in_one_day is not null and  recharge_time_in_one_day - sub_time  >21600 and recharge_time_in_one_day - sub_time <=43200
-         *24小时内新关粉丝关注到订阅时间差
-         *select count(1) from force_users_date_read where first_sub_time is not null and  first_sub_time - sub_time  >43200 and first_sub_time - sub_time <=86400
-         *update force_users_date_read set unsub_time = null where unsub_time = 0
-         */
-        print_r("======每日强关用户行为生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        Log::info("======每日强关用户行为生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        $_start = new \DateTime('2018-01-05');
-        $_end = new \DateTime('2018-03-05');
-
-        foreach (new \DatePeriod($_start, new \DateInterval('P1D'), $_end) as $d)
-        {
-
-            $date = $d->format('Y-m-d');
-            $start = $date;
-            $end = date('Y-m-d', strtotime($date) + 86400);
-
-
-            $offset = 0;
-            $limit = 13000;
-            $data = [];
-            $_m_data = [];
-
-            while (true) {
-
-                print_r("select send_order_id,uid,appid,unsubscribe_time,distribution_channel_id,created_at from force_subscribe_users where created_at > '{$start}' and created_at < '{$end}' limit $offset,$limit" . date("y-m-d H:i:s" . "\n"));
-                $users = DB::select("select send_order_id,uid,appid,unsubscribe_time,distribution_channel_id,created_at from force_subscribe_users where created_at > '{$start}' and created_at < '{$end}' limit $offset,$limit");
-                print_r("users_count:".count($users));
-                if (count($users) == 0) break;
-
-                foreach ($users as $user) {
-                    $is_unsub_in_one_day = false;
-                    $is_pay_in_one_day = false;
-                    $is_pay_in_two_days = false;
-                    $is_pay_in_three_days = false;
-                    $is_unsub_in_two_days = false;
-                    $is_unsub_in_three_days = false;
-
-                    $order_sum_in_one_day = 0;
-                    $order_sum_in_two_day = 0;
-                    $order_sum_in_three_day = 0;
-                    $order_sum_in_one_month = 0;
-
-                    $order = DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->first();
-                    if ($order) {
-                        if (strtotime($order->created_at) < strtotime($user->created_at) + 86400)//24小时内
-                        {
-                            @$data[$user->appid]['pay_user_num_in_one_day']++;
-                            $is_pay_in_one_day = true;
-                        }
-
-                        if (strtotime($order->created_at) < strtotime($user->created_at) + 86400 * 2)//48小时内
-                        {
-                            $is_pay_in_two_days = true;
-                        }
-
-                        if (strtotime($order->created_at) < strtotime($user->created_at) + 86400 * 3)//72小时内
-                        {
-                            @$data[$user->appid]['pay_user_num_in_three_days']++;
-                            $is_pay_in_three_days = true;
-                        }
-
-                        if (strtotime($order->created_at) < strtotime($user->created_at) + 86400 * 30)//30天内
-                        {
-                            @$data[$user->appid]['pay_user_num_in_one_month']++;
-                        }
-
-                        $order_sum_in_one_day = (float)DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at)+86400))->sum('price');
-                        //$order_sum_in_two_day = (float)DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at)+86400*2))->sum('price');
-                        $order_sum_in_three_day = (float)DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at)+86400*3))->sum('price');
-                        $order_sum_in_one_month = (float)DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at)+86400*30))->sum('price');
-
-                    }
-                    @$data[$user->appid]['order_sum_in_one_day'] += $order_sum_in_one_day;
-                    //@$data[$user->appid]['order_sum_in_two_day'] += $order_sum_in_two_day;
-                    @$data[$user->appid]['order_sum_in_three_day'] += $order_sum_in_three_day;
-                    @$data[$user->appid]['order_sum_in_one_month'] += $order_sum_in_one_month;
-
-                    @$data[$user->appid]['fans_num']++;
-                    if ($user->unsubscribe_time && strtotime($user->unsubscribe_time) < strtotime($user->created_at) + 86400)//24小时内取注
-                    {
-                        @$data[$user->appid]['unsub_user_num_in_one_day']++;
-                        $is_unsub_in_one_day = true;
-                    }
-
-                    if ($user->unsubscribe_time && strtotime($user->unsubscribe_time) < strtotime($user->created_at) + 86400*2)//48小时内取注
-                    {
-                        @$data[$user->appid]['unsub_user_num_in_two_days']++;
-                        $is_unsub_in_two_days = true;
-                    }
-
-                    if ($user->unsubscribe_time && strtotime($user->unsubscribe_time) < strtotime($user->created_at) + 86400*3)//72小时内取注
-                    {
-                        @$data[$user->appid]['unsub_user_num_in_three_days']++;
-                        $is_unsub_in_three_days = true;
-                    }
-
-                    if ($user->send_order_id && ($is_unsub_in_one_day || $is_unsub_in_two_days || $is_unsub_in_three_days)) {
-                        $send_order = DB::table('send_orders')->where('id', $user->send_order_id)->first();
-                        if ($send_order->book_id) {
-                            $book = Redis::hget('book_read:' . $user->uid, $send_order->book_id);
-
-                            if ($book) {
-                                $book_info = explode('_', $book);
-
-                                $cid = $book_info[0];
-                                $book_config = DB::table('book_configs')->select(['force_subscribe_chapter_seq','charge_type'])->where('bid', $send_order->book_id)->first();
-
-
-                                $chapter = DB::table('chapters')->select(['sequence'])->where('id', $cid)->first();
-
-                                //判断付费章节
-                                $vip_chapter = DB::table('chapters')->select(['sequence'])->where('bid', $send_order->book_id)->where('is_vip',1)->orderby('sequence')->first();
-
-                                if ($book_config->charge_type == 'BOOK' && $chapter->sequence >= $vip_chapter->sequence - 1)//按本、看书超过付费前一章
-                                {
-                                    $is_unsub_in_one_day && @$data[$user->appid]['unsub_in_one_day_read_last_free_user_num']++;
-                                    $is_unsub_in_two_days && @$data[$user->appid]['unsub_in_two_day_read_last_free_user_num']++;
-                                    $is_unsub_in_three_days && @$data[$user->appid]['unsub_in_three_day_read_last_free_user_num']++;
-                                }
-
-                                if ($book_config->charge_type == 'CHAPTER')//按章节 有订阅无充值
-                                {
-                                    if($is_unsub_in_one_day  && !$is_pay_in_one_day)
-                                    {
-                                        $_day = 1;
-                                        $sub_num = DB::connection('chapter_order_mysql')->table('chapter_orders'.$user->uid%512)->where('uid',$user->uid)->where('bid',$send_order->book_id)->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at) + 86400*$_day))->count();
-                                        $sub_num && @$data[$user->appid]['unsub_in_one_day_read_last_free_user_num']++;
-
-                                    }elseif($is_unsub_in_two_days && !$is_pay_in_two_days)
-                                    {
-                                        $_day = 2;
-                                        $sub_num = DB::connection('chapter_order_mysql')->table('chapter_orders'.$user->uid%512)->where('uid',$user->uid)->where('bid',$send_order->book_id)->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at) + 86400*$_day))->count();
-                                        $sub_num && @$data[$user->appid]['unsub_in_two_day_read_last_free_user_num']++;
-                                    }elseif($is_unsub_in_three_days && !$is_pay_in_three_days)
-                                    {
-                                        $_day = 3;
-                                        $sub_num = DB::connection('chapter_order_mysql')->table('chapter_orders'.$user->uid%512)->where('uid',$user->uid)->where('bid',$send_order->book_id)->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at) + 86400*$_day))->count();
-                                        $sub_num && @$data[$user->appid]['unsub_in_three_day_read_last_free_user_num']++;
-                                    }
-
-                                }
-
-
-                            }
-
-                        }
-
-                    }
-
-                }
-
-                $offset = $offset + $limit;
-
-            }
-
-            foreach ($data as $appid => $item) {
-                $_data = [];
-                $_data['appid'] = $appid;
-                $_data['date'] = $date;
-                $_data['fans_num'] = isset($item['fans_num']) ? $item['fans_num'] : 0;
-                $_data['pay_user_num_in_one_day'] = isset($item['pay_user_num_in_one_day']) ? $item['pay_user_num_in_one_day'] : 0;
-                $_data['read_last_free_user_num'] = isset($item['read_last_free_user_num']) ? $item['read_last_free_user_num'] : 0;
-                $_data['unsub_user_num_in_one_day'] = isset($item['unsub_user_num_in_one_day']) ? $item['unsub_user_num_in_one_day'] : 0;
-                $_data['unsub_in_one_day_read_last_free_user_num'] = isset($item['unsub_in_one_day_read_last_free_user_num']) ? $item['unsub_in_one_day_read_last_free_user_num'] : 0;
-                $_data['unsub_user_num_in_two_days'] = isset($item['unsub_user_num_in_two_days']) ? $item['unsub_user_num_in_two_days'] : 0;
-                $_data['unsub_in_two_day_read_last_free_user_num'] = isset($item['unsub_in_two_day_read_last_free_user_num']) ? $item['unsub_in_two_day_read_last_free_user_num'] : 0;
-                $_data['unsub_user_num_in_three_days'] = isset($item['unsub_user_num_in_three_days']) ? $item['unsub_user_num_in_three_days'] : 0;
-                $_data['unsub_in_three_day_read_last_free_user_num'] = isset($item['unsub_in_three_day_read_last_free_user_num']) ? $item['unsub_in_three_day_read_last_free_user_num'] : 0;
-                $_data['pay_user_num_in_three_days'] = isset($item['pay_user_num_in_three_days']) ? $item['pay_user_num_in_three_days'] : 0;
-                $_data['pay_user_num_in_one_month'] = isset($item['pay_user_num_in_one_month']) ? $item['pay_user_num_in_one_month'] : 0;
-                $_data['order_sum_in_one_day'] = $item['order_sum_in_one_day'];
-                $_data['order_sum_in_three_day'] = $item['order_sum_in_three_day'];
-                $_data['order_sum_in_one_month'] = $item['order_sum_in_one_month'];
-                $_data['created_at'] = $_data['updated_at'] = date('Y-m-d H:i:s');
-                $_m_data[] = $_data;
-            }
-            DB::table('force_users_date_actives')->insert($_m_data);
-
-
-            Log::info("======每日强关用户行为生成 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-            print_r("======每日强关用户行为生成 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-
-
-        }
-    }
-}

+ 0 - 244
app/Console/Commands/ForceUserActive.php.bakk

@@ -1,244 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/20
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands;
-
-use App\Modules\Finance\Services\FinanceService;
-use Log;
-use Illuminate\Console\Command;
-use DB;
-use Redis;
-use App\Modules\Book\Services\BookSubscribleChapterService;
-
-class ForceUserActive extends Command
-{
-    /**
-     * 执行命令   php artisan force_user_active
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'force_user_active';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '每日强关用户行为';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        /**
-         * 更新渠道、公众号信息
-         * update force_users_date_actives,distribution_channels,official_accounts set force_users_date_actives.distribution_channel_id = distribution_channels.id,force_users_date_actives.distribution_channel_name=distribution_channels.nickname,force_users_date_actives.gzh_name = official_accounts.nickname  where force_users_date_actives.appid = official_accounts.appid and official_accounts.distribution_channel_id = distribution_channels.id
-         * select date,distribution_channel_name,gzh_name,distribution_channel_id,fans_num,pay_user_num_in_one_day,unsub_user_num_in_one_day,unsub_in_one_day_read_last_free_user_num,pay_user_num_in_three_days,unsub_user_num_in_two_days,unsub_in_two_day_read_last_free_user_num,unsub_user_num_in_three_days,unsub_in_three_day_read_last_free_user_num,pay_user_num_in_one_month,order_sum_in_one_day,order_sum_in_three_day,order_sum_in_one_month from force_users_date_actives
-         * 24小时内取关粉丝阅读到免费最后一章和取关时间差
-         *select count(1) from force_users_date_read where is_unsub_in_one_day = 1 and  last_free_read_time is not null and unsub_time - last_free_read_time >10800 and unsub_time - last_free_read_time <=10800
-         *24小时内取关粉丝关注到取关时间差
-         *select count(1) from force_users_date_read where is_unsub_in_one_day = 1 and  unsub_time - sub_time >43200 and unsub_time - sub_time <=86400
-         *24小时内新关粉丝阅读到免费最后一章和首充时间差
-         *select count(1) from force_users_date_read where last_free_read_time is not null  and recharge_time_in_one_day is not null and  recharge_time_in_one_day - last_free_read_time >10800 and recharge_time_in_one_day - last_free_read_time <=10800
-         *24小时内新关粉丝关注到首充时间差
-         *select count(1) from force_users_date_read where recharge_time_in_one_day is not null and  recharge_time_in_one_day - sub_time  >21600 and recharge_time_in_one_day - sub_time <=43200
-         *24小时内新关粉丝关注到订阅时间差
-         *select count(1) from force_users_date_read where first_sub_time is not null and  first_sub_time - sub_time  >43200 and first_sub_time - sub_time <=86400
-         *update force_users_date_read set unsub_time = null where unsub_time = 0
-         */
-        print_r("======每日强关用户行为生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        Log::info("======每日强关用户行为生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        $_start = new \DateTime('2018-05-01');
-        $_end = new \DateTime('2018-06-11');
-
-        foreach (new \DatePeriod($_start, new \DateInterval('P1D'), $_end) as $d)
-        {
-
-            $date = $d->format('Y-m-d');
-            $start = $date;
-            $end = date('Y-m-d', strtotime($date) + 86400);
-
-
-            $offset = 0;
-            $limit = 13000;
-            $data = [];
-            $_m_data = [];
-
-            while (true) {
-
-                print_r("select send_order_id,uid,appid,unsubscribe_time,distribution_channel_id,created_at from force_subscribe_users where created_at > '{$start}' and created_at < '{$end}' limit $offset,$limit" . date("y-m-d H:i:s" . "\n"));
-                $users = DB::select("select send_order_id,uid,appid,unsubscribe_time,distribution_channel_id,created_at from force_subscribe_users where created_at > '{$start}' and created_at < '{$end}' limit $offset,$limit");
-                print_r("users_count:".count($users));
-                if (count($users) == 0) break;
-
-                foreach ($users as $user) {
-                    $is_unsub_in_one_day = false;
-                    $is_pay_in_one_day = false;
-                    $is_pay_in_two_days = false;
-                    $is_pay_in_three_days = false;
-                    $is_unsub_in_two_days = false;
-                    $is_unsub_in_three_days = false;
-
-                    $order_sum_in_one_day = 0;
-                    $order_sum_in_two_day = 0;
-                    $order_sum_in_three_day = 0;
-                    $order_sum_in_one_month = 0;
-
-                    $order = DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->first();
-                    if ($order) {
-                        if (strtotime($order->created_at) < strtotime($user->created_at) + 86400)//24小时内
-                        {
-                            @$data[$user->appid]['pay_user_num_in_one_day']++;
-                            $is_pay_in_one_day = true;
-                        }
-
-                        if (strtotime($order->created_at) < strtotime($user->created_at) + 86400 * 2)//48小时内
-                        {
-                            $is_pay_in_two_days = true;
-                        }
-
-                        if (strtotime($order->created_at) < strtotime($user->created_at) + 86400 * 3)//72小时内
-                        {
-                            @$data[$user->appid]['pay_user_num_in_three_days']++;
-                            $is_pay_in_three_days = true;
-                        }
-
-                        if (strtotime($order->created_at) < strtotime($user->created_at) + 86400 * 30)//30天内
-                        {
-                            @$data[$user->appid]['pay_user_num_in_one_month']++;
-                        }
-
-                        $order_sum_in_one_day = (float)DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at)+86400))->sum('price');
-                        //$order_sum_in_two_day = (float)DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at)+86400*2))->sum('price');
-                        $order_sum_in_three_day = (float)DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at)+86400*3))->sum('price');
-                        $order_sum_in_one_month = (float)DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at)+86400*30))->sum('price');
-
-                    }
-                    @$data[$user->appid]['order_sum_in_one_day'] += $order_sum_in_one_day;
-                    //@$data[$user->appid]['order_sum_in_two_day'] += $order_sum_in_two_day;
-                    @$data[$user->appid]['order_sum_in_three_day'] += $order_sum_in_three_day;
-                    @$data[$user->appid]['order_sum_in_one_month'] += $order_sum_in_one_month;
-
-                    @$data[$user->appid]['fans_num']++;
-                    if ($user->unsubscribe_time && strtotime($user->unsubscribe_time) < strtotime($user->created_at) + 86400)//24小时内取注
-                    {
-                        @$data[$user->appid]['unsub_user_num_in_one_day']++;
-                        $is_unsub_in_one_day = true;
-                    }
-
-                    if ($user->unsubscribe_time && strtotime($user->unsubscribe_time) < strtotime($user->created_at) + 86400*2)//48小时内取注
-                    {
-                        @$data[$user->appid]['unsub_user_num_in_two_days']++;
-                        $is_unsub_in_two_days = true;
-                    }
-
-                    if ($user->unsubscribe_time && strtotime($user->unsubscribe_time) < strtotime($user->created_at) + 86400*3)//72小时内取注
-                    {
-                        @$data[$user->appid]['unsub_user_num_in_three_days']++;
-                        $is_unsub_in_three_days = true;
-                    }
-
-                    if ($user->send_order_id && ($is_unsub_in_one_day || $is_unsub_in_two_days || $is_unsub_in_three_days)) {
-                        $send_order = DB::table('send_orders')->where('id', $user->send_order_id)->first();
-                        if ($send_order->book_id) {
-                            $book = Redis::hget('book_read:' . $user->uid, $send_order->book_id);
-
-                            if ($book) {
-                                $book_info = explode('_', $book);
-
-                                $cid = $book_info[0];
-                                $book_config = DB::table('book_configs')->select(['force_subscribe_chapter_seq','charge_type'])->where('bid', $send_order->book_id)->first();
-
-                                $chapter = DB::table('chapters')->select(['sequence'])->where('id', $cid)->first();
-
-                                if($book_config && $chapter)
-                                {
-                                    //判断付费章节
-                                    $vip_chapter = DB::table('chapters')->select(['sequence'])->where('bid', $send_order->book_id)->where('is_vip',1)->orderby('sequence')->first();
-                                    if($vip_chapter)
-                                    {
-                                        if ($book_config->charge_type == 'BOOK' && $chapter->sequence >= $vip_chapter->sequence - 1)//按本、看书超过付费前一章
-                                        {
-                                            $is_unsub_in_one_day && @$data[$user->appid]['unsub_in_one_day_read_last_free_user_num']++;
-                                            $is_unsub_in_two_days && @$data[$user->appid]['unsub_in_two_day_read_last_free_user_num']++;
-                                            $is_unsub_in_three_days && @$data[$user->appid]['unsub_in_three_day_read_last_free_user_num']++;
-                                        }
-
-                                        if ($book_config->charge_type == 'CHAPTER')//按章节 有订阅无充值
-                                        {
-                                            if($is_unsub_in_one_day  && !$is_pay_in_one_day)
-                                            {
-                                                $_day = 1;
-                                                $sub_num = DB::connection('chapter_order_mysql')->table('chapter_orders'.$user->uid%512)->where('uid',$user->uid)->where('bid',$send_order->book_id)->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at) + 86400*$_day))->count();
-                                                $sub_num && @$data[$user->appid]['unsub_in_one_day_read_last_free_user_num']++;
-
-                                            }elseif($is_unsub_in_two_days && !$is_pay_in_two_days)
-                                            {
-                                                $_day = 2;
-                                                $sub_num = DB::connection('chapter_order_mysql')->table('chapter_orders'.$user->uid%512)->where('uid',$user->uid)->where('bid',$send_order->book_id)->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at) + 86400*$_day))->count();
-                                                $sub_num && @$data[$user->appid]['unsub_in_two_day_read_last_free_user_num']++;
-                                            }elseif($is_unsub_in_three_days && !$is_pay_in_three_days)
-                                            {
-                                                $_day = 3;
-                                                $sub_num = DB::connection('chapter_order_mysql')->table('chapter_orders'.$user->uid%512)->where('uid',$user->uid)->where('bid',$send_order->book_id)->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at) + 86400*$_day))->count();
-                                                $sub_num && @$data[$user->appid]['unsub_in_three_day_read_last_free_user_num']++;
-                                            }
-
-                                        }
-                                    }
-                                }
-
-                            }
-
-                        }
-
-                    }
-
-                }
-
-                $offset = $offset + $limit;
-
-            }
-
-            foreach ($data as $appid => $item) {
-                $_data = [];
-                $_data['appid'] = $appid;
-                $_data['date'] = $date;
-                $_data['fans_num'] = isset($item['fans_num']) ? $item['fans_num'] : 0;
-                $_data['pay_user_num_in_one_day'] = isset($item['pay_user_num_in_one_day']) ? $item['pay_user_num_in_one_day'] : 0;
-                $_data['read_last_free_user_num'] = isset($item['read_last_free_user_num']) ? $item['read_last_free_user_num'] : 0;
-                $_data['unsub_user_num_in_one_day'] = isset($item['unsub_user_num_in_one_day']) ? $item['unsub_user_num_in_one_day'] : 0;
-                $_data['unsub_in_one_day_read_last_free_user_num'] = isset($item['unsub_in_one_day_read_last_free_user_num']) ? $item['unsub_in_one_day_read_last_free_user_num'] : 0;
-                $_data['unsub_user_num_in_two_days'] = isset($item['unsub_user_num_in_two_days']) ? $item['unsub_user_num_in_two_days'] : 0;
-                $_data['unsub_in_two_day_read_last_free_user_num'] = isset($item['unsub_in_two_day_read_last_free_user_num']) ? $item['unsub_in_two_day_read_last_free_user_num'] : 0;
-                $_data['unsub_user_num_in_three_days'] = isset($item['unsub_user_num_in_three_days']) ? $item['unsub_user_num_in_three_days'] : 0;
-                $_data['unsub_in_three_day_read_last_free_user_num'] = isset($item['unsub_in_three_day_read_last_free_user_num']) ? $item['unsub_in_three_day_read_last_free_user_num'] : 0;
-                $_data['pay_user_num_in_three_days'] = isset($item['pay_user_num_in_three_days']) ? $item['pay_user_num_in_three_days'] : 0;
-                $_data['pay_user_num_in_one_month'] = isset($item['pay_user_num_in_one_month']) ? $item['pay_user_num_in_one_month'] : 0;
-                $_data['order_sum_in_one_day'] = $item['order_sum_in_one_day'];
-                $_data['order_sum_in_three_day'] = $item['order_sum_in_three_day'];
-                $_data['order_sum_in_one_month'] = $item['order_sum_in_one_month'];
-                $_data['created_at'] = $_data['updated_at'] = date('Y-m-d H:i:s');
-                $_m_data[] = $_data;
-            }
-            DB::table('force_users_date_actives')->insert($_m_data);
-
-
-            Log::info("======每日强关用户行为生成 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-            print_r("======每日强关用户行为生成 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-
-
-        }
-    }
-}

+ 0 - 148
app/Console/Commands/ForceUserActiveDetail.php

@@ -1,148 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/20
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands;
-
-use App\Modules\Finance\Services\FinanceService;
-use Log;
-use Illuminate\Console\Command;
-use DB;
-use Redis;
-use App\Modules\Book\Services\BookSubscribleChapterService;
-
-class ForceUserActiveDetail extends Command
-{
-    /**
-     * 执行命令   php artisan force_user_active
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'force_user_active_detail';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '每日强关用户行为详细';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        print_r("======每日强关用户行为详细生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        Log::info("======每日强关用户行为详细生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        $_start = new \DateTime('2018-03-16');
-        $_end = new \DateTime('2018-03-17');
-
-        foreach (new \DatePeriod($_start, new \DateInterval('P1D'), $_end) as $d)
-        {
-
-            $date = $d->format('Y-m-d');
-            $start = $date;
-            $end = date('Y-m-d', strtotime($date) + 86400);
-
-            $offset = 0;
-            $limit = 10000;
-            $data = [];
-            $_m_data = [];
-
-            while (true) {
-
-                print_r("select send_order_id,uid,appid,unsubscribe_time,distribution_channel_id,created_at from force_subscribe_users where created_at > '{$start}' and created_at < '{$end}' limit $offset,$limit" . date("y-m-d H:i:s" . "\n"));
-                $users = DB::select("select send_order_id,uid,appid,unsubscribe_time,distribution_channel_id,created_at from force_subscribe_users where created_at > '{$start}' and created_at < '{$end}' limit $offset,$limit");
-                print_r("users_count:".count($users));
-                if (count($users) == 0) break;
-
-                foreach ($users as $user) {
-                    $is_unsub_in_one_day = false;
-                    $is_pay_in_one_day = false;
-
-                    $_read_data = [
-                        'date' => $date,
-                        'appid' => $user->appid,
-                        'uid' => $user->uid,
-                        'sub_time' => strtotime($user->created_at),
-                        'unsub_time' => strtotime($user->unsubscribe_time),
-                    ];
-
-                    $order = DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->first();
-                    if ($order) {
-                        if (strtotime($order->created_at) < strtotime($user->created_at) + 86400)//24小时内
-                        {
-                            $_read_data['recharge_time_in_one_day'] = strtotime($order->created_at);
-                            $is_pay_in_one_day = true;
-                        }
-
-                    }
-
-                    $one_day_time = strtotime($user->created_at) + 86400;
-                    if ($user->unsubscribe_time && strtotime($user->unsubscribe_time) < strtotime($user->created_at) + 86400)//24小时内取注
-                    {
-                        $is_unsub_in_one_day = true;
-                        $_read_data['is_unsub_in_one_day'] = 1;
-                    }
-
-                    $last_read_info = Redis::hget('book_base:' . $user->uid, 'last_read');
-
-                    $send_order = DB::table('send_orders')->where('id', $user->send_order_id)->first();
-                    if ($send_order && $send_order->book_id && $last_read_info) {
-                        $book = Redis::hget('book_read:' . $user->uid, $send_order->book_id);
-                        $book_info = explode('_', $book);
-
-                        $cid = $book_info[0];
-                        $vip_chapter = DB::table('chapters')->select(['sequence'])->where('bid', $send_order->book_id)->where('is_vip', 1)->orderby('sequence')->first();
-
-                        $read_last_free = DB::table('read_records')->where('bid', $send_order->book_id)->where('uid', $user->uid)->where('created_at', '<=', date('Y-m-d H:i:s', $one_day_time))->where('seq', $vip_chapter->sequence - 1)->first();
-
-                        $last_read_array = explode('_', $last_read_info);
-                        $last_read_time = $last_read_array[4];
-
-                        //$_read_data['last_read_time'] = $last_read_time;
-                        $_read_data['last_free_read_time'] = $read_last_free ? strtotime($read_last_free->created_at) : 0;
-
-                        $book_config = DB::table('book_configs')->select(['force_subscribe_chapter_seq','charge_type'])->where('bid', $send_order->book_id)->first();
-                        //订阅
-                        if($book_config->charge_type == 'CHAPTER') {
-                            $first_sub = DB::connection('chapter_order_mysql')->table('chapter_orders' . $user->uid % 512)->where('uid', $user->uid)->where('created_at', '<=', date('Y-m-d H:i:s', $one_day_time))->where('bid', $send_order->book_id)->orderBy('id', 'asc')->first();
-                            $_read_data['first_sub_time'] = $first_sub ? strtotime($first_sub->created_at) : 0;
-                        }
-
-                        if($book_config->charge_type == 'BOOK') {
-                            $_read_last_free = DB::table('read_records')->where('bid', $send_order->book_id)->where('uid', $user->uid)->where('seq', $vip_chapter->sequence - 1)->first();
-                            $_read_data['first_sub_time'] = $_read_last_free ? strtotime($_read_last_free->created_at) : 0;
-                        }
-                    }
-
-                    //第一次点击返回时间
-                    $back_info = DB::table('back_actives')->where('uid',$user->uid)->first();
-                    if($back_info)
-                    {
-                        $_read_data['first_click_back_time'] = strtotime($back_info->created_at);
-                    }
-                    $_read_data['created_at'] = date("Y-m-d H:i:s");
-                    DB::table('force_users_date_read')->insert($_read_data);
-                }
-
-                $offset = $offset + $limit;
-
-            }
-
-            Log::info("======每日强关用户行为详细生成 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-            print_r("======每日强关用户行为详细生成 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-
-
-        }
-    }
-}

+ 0 - 33
app/Console/Commands/Inspire.php

@@ -1,33 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use Illuminate\Foundation\Inspiring;
-
-class Inspire extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'inspire';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = 'Display an inspiring quote';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
-    }
-}

+ 0 - 123
app/Console/Commands/MovedChannelsReback.php

@@ -1,123 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use App\Modules\Channel\Models\Channel;
-use App\Modules\Finance\Models\CommissionRate;
-use App\Modules\Trade\Services\OrderService;
-use DB;
-use GuzzleHttp\Client;
-use Illuminate\Console\Command;
-
-class MovedChannelsReback extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'compensateForChannels';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '云栖迁移渠道补偿';
-
-
-    public function handle()
-    {
-       /* Channel::where([
-            ['created_at','>=',date('Y-m-d H:i:s',strtotime('-1 month'))],
-            ['is_yq_move','=',1]
-        ])->chunk(1000,function($res){
-            foreach ($res as $item){
-                $commission = CommissionRate::where('distribution_channel_id',$item->id)->first();
-                if($commission) {
-                    $commission->rate = 1;
-                    $commission->save();
-                }else{
-                    \Log::error('CompensateForMoveChannelFailed:'.$item->id);
-                }
-            }
-        });*/
-       $distribution_channels = DB::select("SELECT * FROM distribution_channels WHERE distribution_channels.is_yq_move=1 AND NOT EXISTS(SELECT * FROM yq_move_channels WHERE yq_move_channels.distribution_channel_id=distribution_channels.id)");
-       foreach ($distribution_channels as $distribution_channel){
-           //$moved =  DB::table('yq_move_channels')->where('distribution_channel_id',$distribution_channel->id)->first();
-           DB::table('yq_move_channels')->insert(['distribution_channel_id'=>$distribution_channel->id,'created_at'=>date('Y-m-d H:i:s')]);
-       }
-       $to_modifys = DB::table('yq_move_channels')->where('created_at','>=',date('Y-m-d H:i:s',strtotime('-1 month')))->get();
-       foreach ($to_modifys as $to_modify) {
-           $commission = CommissionRate::where('distribution_channel_id',$to_modify->distribution_channel_id)->first();
-           if($commission) {
-               $commission->rate = 1;
-               $commission->save();
-           }else{
-               \Log::error('CompensateForMoveChannelFailed:'.$to_modify->id);
-           }
-       }
-
-       $to_withDraws = DB::table('yq_move_channels')->where('created_at','<',date('Y-m-d H:i:s',strtotime('-3 month')))->get();
-       foreach ($to_withDraws as $to_withDraw) {
-           $commission = CommissionRate::where('distribution_channel_id',$to_withDraw->distribution_channel_id)->first();
-           if($commission) {
-               $commission->rate = 0.9;
-               $commission->save();
-           }else{
-               \Log::error('CompensateForMoveChannelFailed:'.$to_withDraw->id);
-           }
-       }
-       $senven_days_ago = date('Y-m-d H:i:s',strtotime('-7 day'));
-       $senven_days_later = DB::select("SELECT * FROM yq_move_channels WHERE created_at < '".$senven_days_ago."' AND distribution_channel_id NOT IN (4217) AND EXISTS (SELECT * FROM distribution_channels WHERE is_yq_move = 1 AND distribution_channels.id=yq_move_channels.distribution_channel_id)");//DB::table('yq_move_channels')->where('created_at','<',date('Y-m-d H:i:s',strtotime('-7 day')))->get();
-        \Log::info('distribution_channels_to_modify:'.json_encode($senven_days_later));
-        self::update_distribution($senven_days_later);
-        $month_ago = date('Y-m-d H:i:s',strtotime('-1 month'));
-        $res = DB::select("SELECT * FROM yq_move_channels WHERE created_at < '".$month_ago."' AND distribution_channel_id IN (4217) AND EXISTS (SELECT * FROM distribution_channels WHERE is_yq_move = 1 AND distribution_channels.id=yq_move_channels.distribution_channel_id)");
-        self::update_distribution($res);
-    }
-
-    static public function getUserClient()
-    {
-        return new Client(['base_uri' => env('AUTH_API_BASE_URI')]);
-    }
-     private function update_distribution($data){
-         foreach ($data as $item) {
-             //DB::beginTransaction();
-             //if(!in_array($item->distribution_channel_id,[4217])){
-                 $distribution_channel = Channel::where('id',$item->distribution_channel_id)->first();
-                 $distribution_channel->is_yq_move = 0;
-                 $distribution_channel->save();
-
-                 $res = DB::table('official_accounts')
-                     ->where('distribution_channel_id',$item->distribution_channel_id)
-                     ->get();
-                 foreach ($res as $officail_account) {
-                     $gzh_app_id = isset($officail_account->appid)?$officail_account->appid:env('WECHAT_AUTH_APPID');
-
-                     try {
-
-                         $timestamp = time();
-                         $params = array('authorizer_appid' => $officail_account->appid,'set_type'=>'menu', "timestamp" => $timestamp);
-                         $sign = get_sign($params);
-
-                         $resJson = self::getUserClient()->request("GET", "auto_set_menu_and_template_test",
-                             ['query' => ['set_type' => 'menu','authorizer_appid'=>$officail_account->appid, 'timestamp' => $timestamp, 'sign' => $sign]]
-                         )->getBody()->getContents();
-                         //\Log::info('authorize_menu_done:'.json_encode($resJson));
-                         //if($resJson){
-
-                         //}
-                     } catch (\Exception $e) {
-                         \Log::error('menu_authorized_fail:'.$e->getMessage());
-                         DB::rollback();
-                         continue;
-                     }
-                     DB::commit();
-                     \Log::info('authorized_accounts:'.json_encode($officail_account));
-                 }
-             }
-
-         }
-     //}
-}

+ 0 - 46
app/Console/Commands/NoPayRemind.php

@@ -1,46 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use App\Modules\OfficialAccount\Services\CustomMsgService;
-class NoPayRemind extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'Pay:remind';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '未支付订单提醒';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $this->payRemind();
-    }
-
-    public function payRemind(){
-        CustomMsgService::sendUnpaid();
-    }
-}

+ 0 - 71
app/Console/Commands/OfficialAccountBillsTask.php

@@ -1,71 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use App\Modules\Trade\Services\OrderService;
-use DB;
-use Illuminate\Console\Command;
-
-class OfficialAccountBillsTask extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'official_account_bills_task  {--start=} {--end=} {--day=}';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '服务号每日充值统计';
-
-
-    public function handle()
-    {
-        $start = $this->option('start');
-        $end = $this->option('end');
-        $day = $this->option('day');
-        if($start && $end){
-             $this->start_scope($start,$end);
-        }elseif($day){
-            $this->start_day($day);
-        }else{
-            $this->start();
-        }
-    }
-
-    private function start(){
-        $yesterday = date('Y-m-d', strtotime(date("Y-m-d") . " -1 day"));
-        //echo '$yesterday'.$yesterday.PHP_EOL;
-        $data = OrderService::getRechargeAmountGroupByOfficial($yesterday);
-        DB::table('official_account_bills')->insert($data);
-    }
-
-
-    private function start_scope($start,$end){
-
-        if(strtotime($start) >= strtotime($end)){
-            return false;
-        }
-        $temp_start = $start;
-        while (true){
-            $this->start_day($temp_start);
-            if($temp_start == $end){
-                break;
-            }
-            $temp_start = date('Y-m-d',strtotime($temp_start)+86400);
-        }
-        return 1;
-    }
-
-
-    private function start_day($day){
-        //echo $day.PHP_EOL;
-        $data = OrderService::getRechargeAmountGroupByOfficial($day);
-        DB::table('official_account_bills')->insert($data);
-    }
-
-}

+ 0 - 214
app/Console/Commands/OfficialAccountStat/SubUserRecharge.php

@@ -1,214 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/20
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands\OfficialAccountStat;
-
-use Log;
-use Illuminate\Console\Command;
-use DB;
-
-class SubUserRecharge extends Command
-{
-    /**
-     * 执行命令   php artisan force_user_active
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'sub_user_recharge';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '强关粉丝充值统计';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        /**
-         * CREATE TABLE `sub_user_recharge_stat` (
-        `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
-        `date` date DEFAULT NULL,
-        `appid` varchar(255) DEFAULT NULL,
-        `fans_num` int(11) DEFAULT NULL,
-        `order_sum_in_one_day` decimal(11,2) DEFAULT NULL,
-        `order_sum_in_three_day` decimal(11,2) DEFAULT NULL,
-        `unsub_user_num_in_one_month` int(11) DEFAULT NULL,
-        `order_sum_in_one_month` decimal(11,2) DEFAULT NULL,
-        `unsub_user_num_in_two_month` int(11) DEFAULT NULL,
-        `pay_user_num_in_two_month` int(11) DEFAULT NULL,
-        `order_sum_in_two_month` decimal(11,2) DEFAULT NULL,
-        `unsub_user_num_in_three_month` int(11) DEFAULT NULL,
-        `order_sum_in_three_month` decimal(11,2) DEFAULT NULL,
-        `pay_user_num_in_three_month` int(11) DEFAULT NULL,
-        `created_at` datetime DEFAULT NULL,
-        `updated_at` datetime DEFAULT NULL,
-        `distribution_channel_id` int(11) DEFAULT NULL,
-        `gzh_name` varchar(255) DEFAULT NULL,
-        `distribution_channel_name` varchar(255) DEFAULT NULL,
-        PRIMARY KEY (`id`)
-        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-         *
-         *
-        update sub_user_recharge_stat,distribution_channels,official_accounts set sub_user_recharge_stat.distribution_channel_id = distribution_channels.id,sub_user_recharge_stat.distribution_channel_name=distribution_channels.nickname,sub_user_recharge_stat.gzh_name = official_accounts.nickname  where sub_user_recharge_stat.appid = official_accounts.appid and official_accounts.distribution_channel_id = distribution_channels.id
-        select distribution_channel_id,gzh_name,distribution_channel_name,date,fans_num,order_sum_in_one_day,order_sum_in_three_day,unsub_user_num_in_one_month,order_sum_in_one_month,unsub_user_num_in_two_month,pay_user_num_in_two_month,order_sum_in_two_month,unsub_user_num_in_three_month,pay_user_num_in_three_month,order_sum_in_three_month from sub_user_recharge_stat
-         */
-        print_r("======强关粉丝充值统计生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        Log::info("======强关粉丝充值统计生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        $_start = new \DateTime('2017-12-12');
-        $_end = new \DateTime('2018-02-18');
-
-        foreach (new \DatePeriod($_start, new \DateInterval('P1D'), $_end) as $d)
-        {
-
-            $date = $d->format('Y-m-d');
-            $start = $date;
-            $end = date('Y-m-d', strtotime($date) + 86400);
-
-            $offset = 0;
-            $limit = 13000;
-            $data = [];
-            $_m_data = [];
-
-            while (true) {
-
-                print_r("select send_order_id,uid,appid,unsubscribe_time,distribution_channel_id,created_at from force_subscribe_users where created_at > '{$start}' and created_at < '{$end}' limit $offset,$limit" . date("y-m-d H:i:s" . "\n"));
-                $users = DB::select("select send_order_id,uid,appid,unsubscribe_time,distribution_channel_id,created_at from force_subscribe_users where created_at > '{$start}' and created_at < '{$end}' limit $offset,$limit");
-                print_r("users_count:".count($users));
-                if (count($users) == 0) break;
-
-                foreach ($users as $user) {
-                    $is_unsub_in_one_day = false;
-                    $is_pay_in_one_day = false;
-                    $is_pay_in_two_days = false;
-                    $is_pay_in_three_days = false;
-                    $is_unsub_in_two_days = false;
-                    $is_unsub_in_three_days = false;
-                    $is_unsub_in_three_month = false;
-
-                    $order_sum_in_one_day = 0;
-                    $order_sum_in_two_day = 0;
-                    $order_sum_in_three_day = 0;
-                    $order_sum_in_one_month = 0;
-                    $order_sum_in_two_month = 0;
-                    $order_sum_in_three_month = 0;
-
-                    $order = DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->first();
-                    if ($order) {
-                        if (strtotime($order->created_at) < strtotime($user->created_at) + 86400)//24小时内
-                        {
-                            @$data[$user->appid]['pay_user_num_in_one_day']++;
-                            $is_pay_in_one_day = true;
-                        }
-
-                        if (strtotime($order->created_at) < strtotime($user->created_at) + 86400 * 2)//48小时内
-                        {
-                            $is_pay_in_two_days = true;
-                        }
-
-                        if (strtotime($order->created_at) < strtotime($user->created_at) + 86400 * 3)//72小时内
-                        {
-                            @$data[$user->appid]['pay_user_num_in_three_days']++;
-                            $is_pay_in_three_days = true;
-                        }
-
-                        if (strtotime($order->created_at) < strtotime($user->created_at) + 86400 * 30)//30天内
-                        {
-                            @$data[$user->appid]['pay_user_num_in_one_month']++;
-                        }
-
-                        if (strtotime($order->created_at) < strtotime($user->created_at) + 86400 * 60)//60天内
-                        {
-                            @$data[$user->appid]['pay_user_num_in_two_month']++;
-                        }
-
-                        if (strtotime($order->created_at) < strtotime($user->created_at) + 86400 * 90)//90天内
-                        {
-                            @$data[$user->appid]['pay_user_num_in_three_month']++;
-                        }
-
-                        $order_sum_in_one_day = (float)DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at)+86400))->sum('price');
-                        //$order_sum_in_two_day = (float)DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at)+86400*2))->sum('price');
-                        $order_sum_in_three_day = (float)DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at)+86400*3))->sum('price');
-                        $order_sum_in_one_month = (float)DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at)+86400*30))->sum('price');
-                        $order_sum_in_two_month = (float)DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at)+86400*60))->sum('price');
-                        $order_sum_in_three_month = (float)DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at)+86400*90))->sum('price');
-
-
-                    }
-                    @$data[$user->appid]['order_sum_in_one_day'] += $order_sum_in_one_day;
-                    @$data[$user->appid]['order_sum_in_three_day'] += $order_sum_in_three_day;
-                    @$data[$user->appid]['order_sum_in_one_month'] += $order_sum_in_one_month;
-                    @$data[$user->appid]['order_sum_in_two_month'] += $order_sum_in_two_month;
-                    @$data[$user->appid]['order_sum_in_three_month'] += $order_sum_in_three_month;
-
-                    @$data[$user->appid]['fans_num']++;
-
-                    if ($user->unsubscribe_time && strtotime($user->unsubscribe_time) < strtotime($user->created_at) + 86400*30)//30天内取注
-                    {
-                        @$data[$user->appid]['unsub_user_num_in_one_month']++;
-                    }
-
-                    if ($user->unsubscribe_time && strtotime($user->unsubscribe_time) < strtotime($user->created_at) + 86400*60)//60天内取注
-                    {
-                        @$data[$user->appid]['unsub_user_num_in_two_month']++;
-                    }
-
-                    if ($user->unsubscribe_time && strtotime($user->unsubscribe_time) < strtotime($user->created_at) + 86400*90)//90天内取注
-                    {
-                        @$data[$user->appid]['unsub_user_num_in_three_month']++;
-                    }
-
-                }
-
-                $offset = $offset + $limit;
-
-            }
-
-            foreach ($data as $appid => $item) {
-                $_data = [];
-                $_data['appid'] = $appid;
-                $_data['date'] = $date;
-                $_data['fans_num'] = isset($item['fans_num']) ? $item['fans_num'] : 0;
-                $_data['order_sum_in_one_day'] = $item['order_sum_in_one_day'];//24小时充值收益
-                $_data['order_sum_in_three_day'] = $item['order_sum_in_three_day'];//72小时充值
-
-                //30天数据
-                $_data['unsub_user_num_in_one_month'] = isset($item['unsub_user_num_in_one_month']) ? $item['unsub_user_num_in_one_month'] : 0;//30天内取关粉丝数
-                $_data['order_sum_in_one_month'] = $item['order_sum_in_one_month'];//30天充值
-
-                //60天数据
-                $_data['unsub_user_num_in_two_month'] = isset($item['unsub_user_num_in_two_month']) ? $item['unsub_user_num_in_two_month'] : 0;//60天取关粉丝数
-                $_data['pay_user_num_in_two_month'] = isset($item['pay_user_num_in_two_month']) ? $item['pay_user_num_in_two_month'] : 0;//60天内首充用户数
-                $_data['order_sum_in_two_month'] = $item['order_sum_in_two_month'];//60天充值
-
-                //90天数据
-                $_data['unsub_user_num_in_three_month'] = isset($item['unsub_user_num_in_three_month']) ? $item['unsub_user_num_in_three_month'] : 0;//90天取关粉丝数
-                $_data['order_sum_in_three_month'] = $item['order_sum_in_three_month'];//90天充值
-                $_data['pay_user_num_in_three_month'] = isset($item['pay_user_num_in_three_month']) ? $item['pay_user_num_in_three_month'] : 0;//90天内首充用户数
-
-                $_data['created_at'] = $_data['updated_at'] = date('Y-m-d H:i:s');
-                $_m_data[] = $_data;
-            }
-            DB::table('sub_user_recharge_stat')->insert($_m_data);
-
-            Log::info("======强关粉丝充值统计生成 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-            print_r("======强关粉丝充值统计生成 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-
-
-        }
-    }
-}

+ 0 - 47
app/Console/Commands/PaidUserRemind.php

@@ -1,47 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use App\Modules\OfficialAccount\Services\CustomMsgService;
-class PaidUserRemind extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'PaidUserRemind';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = 'PaidUserRemind';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $this->start();
-    }
-
-    public function start(){
-        CustomMsgService::add_template_pay_push_daily();
-
-    }
-}

+ 0 - 107
app/Console/Commands/PayChannelCheck.php

@@ -1,107 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use App\Modules\Channel\Services\ChannelService;
-use App\Libs\Pay\WechatPay;
-use DB;
-use App\Libs\SMS;
-use App\Libs\Pay\Merchants\AllinPay;
-use App\Libs\PayClient;
-class PayChannelCheck extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'pay:check';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '支付通道检测报警切换';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $this->start();
-    }
-
-    public function start(){
-        $res = $this->getPayChannel();
-        print_r($res);
-        if(empty($res)){
-            //$this->sendMsg();
-            //$this->changechannel();
-        }
-    }
-
-    private function getPayChannel(){
-        $channel = ChannelService::getById(5);
-        $pay_merchant = DB::table('pay_merchants')->select('appid','source','config_info')->where('id',$channel->pay_merchant_id)->where('is_enabled',1)->first();
-        $config = json_decode($pay_merchant->config_info,true);
-        $wechatPay = WechatPay::instance($pay_merchant->source,$config);
-        $data = [
-            'body'=>'novel buy',
-            'detail'=>'novel buy',
-            'trade_no'=>date("YmdHis").'check',
-            'openid'=>'oEteU1USo_yaT0NzA4QttI6Tl7gU',
-            'price'=>1,
-            'create_ip'=>'47.96.174.172',
-            'remark'=>json_encode(
-                [
-                    'uid'=>13,
-                    'dcd'=>5,
-                    'bid'=>0,
-                    'cp'=>'47.96.174.172',
-                    'pms'=>$pay_merchant->source,
-                    'pmi'=>$channel->pay_merchant_id,
-                    'pd'=>1,
-                    'soi'=>1,
-                ]
-            )
-        ];
-        $pay_info = $wechatPay->send($data);
-        return $pay_info;
-    }
-
-    private function changechannel(){
-        DB::table('distribution_channels')->where('phone','!=','')->update(['pay_merchant_id'=>3]);
-    }
-
-    private function sendMsg(){
-        //$phone_arr = ['15868100210','18072713392','15088790066','13706510321','13858057394','18668029091'];
-        $phone_arr = ['18668029091'];
-        foreach ($phone_arr as $phone){
-            SMS::send($phone,'支付通道已经切换到官方支付了');
-        }
-
-    }
-
-    public function payChannelSend($type,$config){
-        switch ($type){
-            case 'ALLINPAY':
-                $wechatPay = new AllinPay($config);
-
-            break;
-        }
-    }
-}

+ 0 - 111
app/Console/Commands/PaymentQueryTask.php

@@ -1,111 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/12/21
- * Time: 下午2:12
- */
-
-namespace App\Console\Commands;
-
-use App\Libs\PayHelper;
-use App\Modules\Finance\Services\LiquidatedStatService;
-use App\Modules\Finance\Services\PaymentService;
-use App\Modules\Finance\Services\WithdrawCashService;
-use Log;
-use Illuminate\Console\Command;
-
-class PaymentQueryTask extends Command
-{
-
-    /**
-     * 执行命令   php artisan payment_query_task
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'payment_query_task';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '支付通道打款结果查询';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        print_r("======支付通道打款结果查询 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        Log::info("======支付通道打款结果查询 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        //自动打款中 状态
-        $paymentList = PaymentService::getPaymentList('','', '', WithdrawCashService::getWithdrawCashStatusStrList(21), true);
-
-//        print_r(json_encode($paymentList));
-
-        if(!empty($paymentList)) {
-            foreach ($paymentList as $payment) {
-                $payType = $payment['pay_merchant_source'];
-                $transactionSerialNumber = $payment['trade_no'];
-                $reqSn = date('YmdHis').mt_rand(100000,999999);
-                if(!empty($payType) && !empty($transactionSerialNumber)) {
-                    $resultQueryData = PayHelper::payQuery($payType, $transactionSerialNumber, $reqSn);
-
-                    $resultDataCode = '';
-                    $resultDataMsg = '';
-                    $resultDataHttpDataMsg = json_encode($resultQueryData['http_result_data']);
-
-                    if(!empty($resultQueryData) && !empty($resultQueryData['msg'])) {
-                        $resultDataMsg = $resultQueryData['msg'];
-                    }
-                    if(!empty($resultQueryData)) {
-                        $resultDataCode = $resultQueryData['code'];
-                    }
-
-//                    print_r($resultQueryData);
-
-                    if($resultDataCode == 1) {
-                        WithdrawCashService::updateWithdrawCashStatus($payment['withdraw_cash_id'], '', 31, '', '');
-                        PaymentService::updatePaymentStatus($payment['id'], WithdrawCashService::getWithdrawCashStatusStr(31), $resultDataHttpDataMsg, $resultDataMsg);
-                    } else if($resultDataCode == 2) {
-                        PaymentService::updatePaymentStatus($payment['id'], '', $resultDataHttpDataMsg, $resultDataMsg);
-                    } else {
-                        PaymentService::updatePaymentStatus($payment['id'], WithdrawCashService::getWithdrawCashStatusStr(41), $resultDataHttpDataMsg, $resultDataMsg);
-                        WithdrawCashService::updateWithdrawCashStatus($payment['withdraw_cash_id'], '', 41, '', '');
-                    }
-                }
-            }
-        }
-
-        Log::info("======支付通道打款结果查询 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-        print_r("======支付通道打款结果查询 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-
-
-        print_r("======支付通道余额结果查询 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        Log::info("======支付通道余额结果查询 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        //tonglianpay
-        $payTypes = [config('common.tonglianpay'), config('common.lianlianpay')];
-        foreach ($payTypes as $payType) {
-            $reqSn = date('YmdHis').mt_rand(100000,999999);
-            $resultQueryData = PayHelper::payAccountInfo($payType, $reqSn);
-            if(!empty($resultQueryData) && $resultQueryData['code'] == 1) {
-                $balance = $resultQueryData['balance'];
-                if(is_numeric($balance)) {
-                    $balance = (float)$balance / 100;
-
-                    LiquidatedStatService::updateAccountBalanceAmount($payType, $balance);
-                }
-            }
-            print_r("======支付通道余额结果查询 [".json_encode($resultQueryData)."]".date("y-m-d H:i:s"."\n"));
-            Log::info("======支付通道余额结果查询 [".json_encode($resultQueryData)."]".date("y-m-d H:i:s"."\n"));
-        }
-        Log::info("======支付通道余额结果查询 【任务执行结束】=====[".date("y-m-d H:i:s"."\n"));
-        print_r("======支付通道余额结果查询 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-    }
-}

+ 0 - 62
app/Console/Commands/PaymentStatisticTask.php

@@ -1,62 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/12/5
- * Time: 下午4:24
- */
-
-namespace App\Console\Commands;
-
-use App\Modules\Channel\Services\ChannelService;
-use App\Modules\Finance\Services\FinanceService;
-use Log;
-use Illuminate\Console\Command;
-
-class PaymentStatisticTask extends Command
-{
-    /**
-     * 执行命令   php artisan payment_statistic_task
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'payment_statistic_task';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '每日打款报表生成';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        print_r("======每日打款报表生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        Log::info("======每日打款报表生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        $channels = $this->getAllChannel();
-        foreach ($channels as $channel) {
-            //print_r($channel->id."=".$channel->name."\n");
-            $channelId = $channel->id;
-            FinanceService::makeYesterdayWithdrawCashStatistics($channelId);
-//            print_r($channelId."=".$channelName."=".$rechargeAmount."\n");
-        }
-        Log::info("======每日打款报表生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-        print_r("======每日打款报表生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-    }
-
-    /**
-     * 获取所有渠道
-     * @return mixed
-     */
-    public function getAllChannel() {
-        $channels = ChannelService::getAllChannels();
-        return $channels;
-    }
-}

+ 0 - 49
app/Console/Commands/ProductStats/DailyProductionStats.php

@@ -1,49 +0,0 @@
-<?php
-
-namespace App\Console\Commands\ProductStats;
-
-use App\Modules\Statistic\Services\ProductionStatsEmailService;
-
-use Illuminate\Console\Command;
-
-class DailyProductionStats extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'saveDailyProductsStats';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '保存每日作品分析数据';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        //
-        $from_date = date('Y-m-d 00:00:00',strtotime('-1 day'));
-        $end_date = date('Y-m-d 23:59:59',strtotime('-1 day'));
-
-        //ProductionStatsEmailService::setDayStats($from_date,$end_date);
-        ProductionStatsEmailService::setDayStatsNew($from_date,$end_date);
-    }
-}

+ 0 - 49
app/Console/Commands/ProductStats/MonthlyProductionStats.php

@@ -1,49 +0,0 @@
-<?php
-
-namespace App\Console\Commands\ProductStats;
-
-use App\Modules\Statistic\Services\ProductionStatsEmailService;
-
-use Illuminate\Console\Command;
-
-class MonthlyProductionStats extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'saveMonthlyProductsStats';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '发送每日作品分析报表';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        //
-        $from_date = date('Y-m-01 00:00:00',strtotime('-1 month'));
-        $end_date = date('Y-m-d 23:59:59',strtotime(date('Y-m-01').' -1 day'));
-
-        ProductionStatsEmailService::setMonthStats($from_date,$end_date);
-
-    }
-}

+ 0 - 89
app/Console/Commands/ProductStats/SendDailyProductionStats.php

@@ -1,89 +0,0 @@
-<?php
-
-namespace App\Console\Commands\ProductStats;
-
-use App\Modules\Statistic\Services\ProductionStatsEmailService;
-
-use App\Modules\Statistic\Services\SendStatsEmailService;
-use Illuminate\Console\Command;
-use DB;
-
-class SendDailyProductionStats extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'SendDailyProductsStats';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '发送每日作品分析数据';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        //
-        $date = date('Y-m-d',strtotime('-1 day'));
-        $data = DB::table('product_stats')
-            ->where([['date','=',$date],['type','=','day']])
-            ->first();
-        if($data) {
-            $data = json_decode(json_encode($data),true);
-            $data['date'] = $date;
-        }else{
-            $data = ProductionStatsEmailService::getAll(date('Y-m-d 00:00:00',strtotime('-1 day')),date('Y-m-d 23:59:59',strtotime('-1 day')));
-            $data['date'] = $date;
-        }
-
-        $suspends = ProductionStatsEmailService::getSuspendProducts(false);
-        $suspends_format = array();
-        foreach ($suspends as $suspend){
-            $time_diff = time()-strtotime($suspend->updated_at);
-            $product_type = $suspend->is_on_shelf;
-            switch ($product_type){
-                case 1:$product_type = '内部作品';break;
-                case 2:$product_type = '外部作品';break;
-                default:;
-            }
-            $suspends_format[] = array($suspend->id,$suspend->name,$suspend->pid,$suspend->updated_at,round(($time_diff)/3600,1),round($time_diff/(3600*24),1),$product_type);
-        }
-        $suspends_header = ['bid','书名','一级分类','最近更新','累计断更时长(小时)','断更天数','作品类型'];
-        saveExcelData($suspends_header ,$suspends_format,storage_path('app/suspend_books'.date('Y-m-d').'.xlsx'));
-        $to_user = array(
-                ['address'=>'zhangzg@iqiyoo.com','name'=>'张总'],
-                //['address'=>'1373617746@qq.com','name'=>'tusx'],
-                ['address'=>'songdb@iqiyoo.com','name'=>'songdb'],
-                ['address'=>'zhaojp@yqsd.net','name'=>'赵君平'],
-                ['address'=>'huangrr@yqsd.net','name'=>'黄蓉蓉'],
-                ['address'=>'wankw@zw88.net','name'=>'万开伟'],
-                ['address'=>'liur@iqiyoo.com','name'=>'刘嵘'],
-                ['address'=>'chensj@zw88.net','name'=>'chensj'],
-                ['address'=>'sijj@yqsd.net','name'=>'sijj'],
-                ['address'=>'yuyy@yqsd.net','name'=>'俞焰艳']
-        );
-
-        $page = view('email.productStats',['data'=>$data,'datas2'=>$suspends_format,'title'=>$date.' 作品数据报表','title2'=>$date.' 断更作品']);
-        $html = response($page)->getContent();
-        SendStatsEmailService::SendHtmlEmailWithAcce($to_user,['subject'=>"每日作品数据报表",'body'=>$html],storage_path('app/suspend_books'.date('Y-m-d').'.xlsx'));
-
-    }
-}

+ 0 - 84
app/Console/Commands/ProductStats/SendMonthStatsEmail.php

@@ -1,84 +0,0 @@
-<?php
-
-namespace App\Console\Commands\ProductStats;
-
-use App\Modules\Statistic\Services\SendStatsEmailService;
-use Illuminate\Console\Command;
-
-class SendMonthStatsEmail extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'sendMonthOrderEmail';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '发送外部派单作品分析报表';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        //
-        $lastMonthBegin = date('Y-m-01',strtotime('-1 month'));
-        $lastMonthEnd   = date('Y-m-d',strtotime(date('Y-m-01').' -1 day'));
-
-        $data = SendStatsEmailService::getOrderStats($lastMonthBegin,$lastMonthEnd);
-        //var_dump($data);
-        $data = json_decode(json_encode($data),true);
-        $page = view('email.monthStats',['datas'=>$data,'month'=>date('m月',strtotime('-1 month'))]);
-        $html = response($page)->getContent();
-        //\Log::info($html);
-        $data_temp = array();
-        foreach ($data as $key=>$value){
-            $data_temp[] = array(
-                $value['bid'],
-                $value['book_name'],
-                $value['order_num'],
-                $value['UV'],
-                $value['register_user_sum'],
-                $value['recharge_sum'],
-                $value['pid'],
-                $value['order_num']>0?round($value['register_user_sum']/$value['order_num'],2):0,
-                $value['order_num']>0?round($value['recharge_sum']/$value['order_num'],2):0,
-                $value['register_user_sum']>0?round($value['recharge_sum']/$value['register_user_sum'],2):0
-            );
-        }
-        $header = ['书籍ID','书籍名称','实际派单数','UV','注册用户数','充值','男女频','注册/派单','充值/派单','充值/注册'];
-        saveExcelData($header,$data_temp,storage_path('app/last_month_send_order.xlsx'));
-
-        $to_user = array(
-            ['address'=>'zhangzg@iqiyoo.com','name'=>'张总'],
-            //['address'=>'1373617746@qq.com','name'=>'tusx'],
-            ['address'=>'songdb@iqiyoo.com','name'=>'songdb'],
-            ['address'=>'zhaojp@yqsd.net','name'=>'赵君平'],
-            ['address'=>'huangrr@yqsd.net','name'=>'黄蓉蓉'],
-            ['address'=>'wankw@zw88.net','name'=>'万开伟'],
-            ['address'=>'liur@iqiyoo.com','name'=>'刘嵘'],
-            ['address'=>'chensj@zw88.net','name'=>'chensj'],
-            ['address'=>'sijj@yqsd.net','name'=>'sijj'],
-            ['address'=>'yuyy@yqsd.net','name'=>'俞焰艳'],
-
-        );
-        SendStatsEmailService::SendHtmlEmailWithAcce($to_user,['subject'=>date('m月',strtotime('-1 month'))."外部派单作品分析报表(修订)",'body'=>$html],storage_path('app/last_month_send_order.xlsx'));
-    }
-}

+ 0 - 75
app/Console/Commands/ProductStats/SendMonthlyProductStats.php

@@ -1,75 +0,0 @@
-<?php
-
-namespace App\Console\Commands\ProductStats;
-
-use App\Modules\Statistic\Services\ProductionStatsEmailService;
-
-use App\Modules\Statistic\Services\SendStatsEmailService;
-use Illuminate\Console\Command;
-use DB;
-
-class SendMonthlyProductStats extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'SendMonthlyProductsStats';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '发送每月作品分析数据';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        //
-        $date = date('Y-m-01',strtotime('-1 month'));
-        $data = DB::table('product_stats')
-            ->where([['date','=',$date],['type','=','month']])
-            ->first();
-        if($data) {
-            $data = json_decode(json_encode($data),true);
-            $data['date'] = date('Y-m',strtotime('-1 month'));
-        }else{
-            $data = ProductionStatsEmailService::getAll(date('Y-m-01 00:00:00',strtotime('-1 month')),date('Y-m-d 23:59:59',strtotime(date('Y-m-01').'-1 day')));
-            $data['date'] = date('Y-m',strtotime('-1 month'));
-        }
-        $to_user = array(
-            ['address'=>'zhangzg@iqiyoo.com','name'=>'张总'],
-            //['address'=>'tushengxiang@yahoo.com','name'=>'tusx'],
-            ['address'=>'songdb@iqiyoo.com','name'=>'songdb'],
-            ['address'=>'zhaojp@yqsd.net','name'=>'赵君平'],
-            ['address'=>'huangrr@yqsd.net','name'=>'黄蓉蓉'],
-            ['address'=>'wankw@zw88.net','name'=>'万开伟'],
-            ['address'=>'liur@iqiyoo.com','name'=>'刘嵘'],
-            ['address'=>'chensj@zw88.net','name'=>'chensj'],
-            ['address'=>'sijj@yqsd.net','name'=>'sijj'],
-            ['address'=>'yuyy@yqsd.net','name'=>'俞焰艳']
-        );
-
-        $page = view('email.productStats',['data'=>$data,'title'=>date('m月',strtotime('-1 month')).' 作品数据报表']);
-        $html = response($page)->getContent();
-
-        SendStatsEmailService::SendHtmlEmailWithAcce($to_user,['subject'=>date('m月',strtotime('-1 month'))."作品数据报表",'body'=>$html]);
-
-    }
-}

+ 0 - 47
app/Console/Commands/RecoverPush.php

@@ -1,47 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use App\Modules\OfficialAccount\Services\CustomMsgService;
-class RecoverPush extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'recoverpush';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = 'Command description';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $this->recoverActivity();
-    }
-
-    public function recoverActivity(){
-        CustomMsgService::add_news_recovery_push_hot();
-        CustomMsgService::add_news_recovery_push_activity();
-    }
-}

+ 0 - 76
app/Console/Commands/RepeatBookOrderRecover.php

@@ -1,76 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use DB;
-class RepeatBookOrderRecover extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'book:bor {--type=}';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '单本订购重复订单恢复';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $options = $this->option('type');
-        if($options){
-            echo $this->stats();
-        }else{
-            echo $this->start();
-        }
-        return;
-    }
-
-    public function  start(){
-        $sql = "SELECT uid,bid,COUNT(*) FROM book_orders where uid>0 and bid>0 GROUP BY uid,bid HAVING COUNT(*) >=2";
-        $res = DB::select($sql);
-        $i = 0;
-        foreach ($res as $v){
-            $order = DB::table('book_orders')->where('bid',$v->bid)->where('uid',$v->uid)->first();
-            $update_user_sql = "UPDATE users set balance = balance+{$order->fee},reward_balance=reward_balance+{$order->reward_balance},charge_balance=charge_balance+{$order->charge_balance} where id = {$order->uid}";
-            DB::update($update_user_sql);
-            DB::table('book_orders')->where('id',$order->id)->update(['uid'=>-$order->uid]);
-            $i++;
-        }
-        return '修改了'.$i.'个用户';
-    }
-
-    public function stats(){
-        $sql = "SELECT  id,bid,fee,date(created_at) as days,send_order_id,charge_balance,reward_balance FROM book_orders WHERE uid<0 and fee >0";
-        $res = DB::select($sql);
-        $i = 0;
-        foreach ($res as $v){
-            $update_sql = "update book_order_statistical set fee=fee-{$v->fee}, reward_balance=reward_balance-{$v->reward_balance}, charge_balance=charge_balance-{$v->charge_balance} where bid={$v->bid} and `day`='{$v->days}'";
-            DB::update($update_sql);
-            DB::table('book_orders')->where('id',$v->id)->update(['fee'=>0]);
-            //DB::table('book_order_statistical')->where('bid',$v->bid)->where('day',$v->days)->
-            $i++;
-        }
-        return '修改了'.$i.'个记录';
-    }
-}

+ 0 - 85
app/Console/Commands/SendOrder/GenerateBookUvRegisterStat.php

@@ -1,85 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: sogndb
- * Date: 2018/02/05
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands\SendOrder;
-
-use App\Modules\Statistic\Services\SendStatsEmailService;
-use DB;
-use Illuminate\Console\Command;
-use Log;
-
-class GenerateBookUvRegisterStat extends Command
-{
-    /**
-     * 执行命令   php artisan send_order:generate_day_stat
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'sendOrder_book_uv_register_stat';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '内外部派单按书累计数据';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $date_end = date("Y-m-d");
-        $date_begin = date("Y-m-d", strtotime(' -1 day'));
-
-        $base_sql = "SELECT book_name,bid,sum(uv) as total_uv, sum(register_user_num) total_register_user_num 
-        FROM send_orders_stats WHERE send_time BETWEEN '%s' AND '%s'";
-        //内部
-        $inside_sql = $base_sql . "AND force_user_num<20 GROUP BY bid ORDER BY total_uv desc LIMIT 10";
-        $inside_result = DB::select(sprintf($inside_sql, $date_begin, $date_end));
-
-        //外部
-        $outside_sql = $base_sql . "AND force_user_num>=20  GROUP BY bid ORDER BY total_register_user_num desc LIMIT 10";
-        $outside_result = DB::select(sprintf($outside_sql, $date_begin, $date_end));
-
-        $to_user = array(
-            ['address' => 'zhangzg@iqiyoo.com', 'name' => '张总'],
-            ['address' => 'songdb@iqiyoo.com', 'name' => 'songdb'],
-            ['address' => 'zhaojp@yqsd.net', 'name' => '赵君平'],
-            ['address' => 'huangrr@yqsd.net', 'name' => '黄蓉蓉'],
-            ['address' => 'wankw@zw88.net', 'name' => '万开伟'],
-            ['address' => 'liur@iqiyoo.com', 'name' => '刘嵘'],
-            ['address' => 'chensj@zw88.net', 'name' => '陈帅君'],
-            ['address' => 'yuyy@yqsd.net', 'name' => '俞焰艳'],
-            ['address' => 'sijj@yqsd.net', 'name' => 'sijj@yqsd.net'],
-        );
-
-        $content ='';
-        if ($inside_result) {
-            $content .= "<table border='1' cellpadding='10' cellspacing='0'><tr><td align='center'>类型</td><td align='center'>书本id</td><td align='center'>书名</td><td align='center'>总UV</td><td align='center'>总注册用户数</td></tr>";
-            foreach ($inside_result as $item) {
-                $content .= "<tr><td align='center'>内部派单</td><td align='center'>{$item->bid}</td><td align='center'>{$item->book_name}</td><td align='center'>{$item->total_uv}</td><td align='center'>{$item->total_register_user_num}</td></tr>";
-            }
-            $content .= "</table>";
-        }
-
-        $content.='</hr>';
-        if ($outside_result) {
-            $content .= "<table border='1' cellpadding='10' cellspacing='0'><tr><td align='center'>类型</td><td align='center'>书本id</td><td align='center'>书名</td><td align='center'>总UV</td><td align='center'>总注册用户数</td></tr>";
-            foreach ($outside_result as $item) {
-                $content .= "<tr><td align='center'>外部派单</td><td align='center'>{$item->bid}</td><td align='center'>{$item->book_name}</td><td align='center'>{$item->total_uv}</td><td align='center'>{$item->total_register_user_num}</td></tr>";
-            }
-            $content .= "</table>";
-        }
-        SendStatsEmailService::SendHtmlEmailWithAcce($to_user, ['subject' => date("Y-m-d", time()) . "内外部派单按书统计数据", 'body' => $content]);
-    }
-}

+ 0 - 54
app/Console/Commands/SendOrder/GenerateForceDayStat.php

@@ -1,54 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: sogndb
- * Date: 2018/02/05
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands\SendOrder;
-
-use App\Modules\SendOrder\Services\SendOrderForceDayStatService;
-use App\Modules\SendOrder\Services\SendOrderStatService;
-use Illuminate\Console\Command;
-use Log;
-
-class GenerateForceDayStat extends Command
-{
-    /**
-     * 执行命令   php artisan send_order_generate_force_day_stat
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'send_order:generate_force_day_stat';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '每日图书派单数据生成';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        ini_set('memory_limit', '1280M');
-        print_r("======每日图书派单数据生成 【任务执行开始】=====" . date("y-m-d H:i:s" . "\n"));
-        Log::info("======每日图书派单数据生成 【任务执行开始】=====" . date("y-m-d H:i:s" . "\n"));
-        //TODO 将时间改为今天
-        $date = date("Y-m-d", strtotime(' -1 day'));
-        SendOrderForceDayStatService::generateForceDayStat($date);
-        //生成汇总
-        //SendOrderStatService::generateStat();
-
-
-        Log::info("======每日图书派单数据生成 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-        print_r("======每日图书派单数据生成 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-    }
-}

+ 0 - 51
app/Console/Commands/SendOrder/GenerateStat.php

@@ -1,51 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: sogndb
- * Date: 2018/02/05
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands\SendOrder;
-
-use App\Modules\SendOrder\Services\SendOrderStatService;
-use Log;
-use Illuminate\Console\Command;
-
-class GenerateStat extends Command
-{
-    /**
-     * 执行命令   php artisan send_order:generate_day_stat
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'send_order:generate_stat';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '派单统计数据生成';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        ini_set('memory_limit', '1024M');
-        print_r('memory_used:'.memory_get_usage()."\n");
-        print_r("======派单统计数据生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        Log::info("======派单统计数据生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        //SendOrderStatService::generateStat();
-        SendOrderStatService::generateStatsByChunk();
-        Log::info("======派单统计数据生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-        print_r("======派单统计数据生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-        print_r('memory_used:'.memory_get_usage()."\n");
-    }
-}

+ 0 - 151
app/Console/Commands/SendOrder/SendStatsEmail.php

@@ -1,151 +0,0 @@
-<?php
-
-namespace App\Console\Commands\SendOrder;
-
-use App\Modules\Book\Services\BookTagsService;
-use App\Modules\Statistic\Services\SendStatsEmailService;
-use Illuminate\Console\Command;
-
-class SendStatsEmail extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'sendOrderEmail';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '发送外部派单作品分析报表';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        //
-        $this->getSuperiorBooks();
-        return ;
-        $beginLastweek = date('Y-m-d',mktime(0,0,0,date('m'),date('d')-date('w')+1-7,date('Y')));
-        $endLastweek   = date('Y-m-d',mktime(23,59,59,date('m'),date('d')-date('w')+7-7,date('Y')));
-
-        $data = SendStatsEmailService::getOrderStats($beginLastweek,$endLastweek);
-
-        $page = view('email.weekOrderStats',['datas'=>$data]);
-        $html = response($page)->getContent();
-        //\Log::info($html);
-        $data_temp = array();
-        $header = ['书籍ID','书籍名称','UV','注册用户数','注册/UV','强关粉','强关率(强关/注册)','充值金额','付费人数','充值/UV','强关付费率(付费/强关)','UV付费率(付费/UV)','派单数','男女频'];
-        foreach ($data as $k=>$item) {
-            $title='';
-            switch ($k){
-                case 0:$title='注册UV比高于85%';break;
-                case 1:$title='注册UV比介于30%到85%';break;
-                case 2:$title='注册UV比低于30%';break;
-            }
-            $temp = array('header'=>$header,'title'=>$title,'data'=>array());
-            foreach ($item as $key=>$value) {
-                $temp['data'][] = array(
-                    $value['bid'],
-                    $value['book_name'],
-                    $value['UV'],
-                    $value['register_user_sum'],
-                    $value['UV']>0?(round($value['register_user_sum']/$value['UV'],4)*100).'%':0,
-                    $value['force_user_sum'],
-                    $value['register_user_sum']>0?(round($value['force_user_sum']/$value['register_user_sum'],4)*100).'%':0,
-                    $value['recharge_sum'],
-                    $value['pay_user_num'],
-                    $value['UV']>0?round($value['recharge_sum']/ $value['UV'],2):0,
-                    $value['force_user_sum']>0?(round($value['pay_user_num']/$value['force_user_sum'],4)*100).'%':0,
-                    $value['UV']>0?(round($value['pay_user_num']/$value['UV'],4)*100).'%':0,
-                    $value['send_orders_num'],
-                    $value['pid']
-                );
-            }
-            $data_temp[] = $temp;
-        }
-       saveExcelDataToMultiSheet($data_temp,storage_path('app/last_week_send_order.xlsx'));
-
-        $to_user = array(
-            ['address'=>'zhangzg@iqiyoo.com','name'=>'张总'],
-            //['address'=>'1373617746@qq.com','name'=>'tusx'],
-            ['address'=>'songdb@iqiyoo.com','name'=>'songdb'],
-            ['address'=>'zhaojp@yqsd.net','name'=>'赵君平'],
-            ['address'=>'huangrr@yqsd.net','name'=>'黄蓉蓉'],
-            ['address'=>'wankw@zw88.net','name'=>'万开伟'],
-            ['address'=>'liur@iqiyoo.com','name'=>'刘嵘'],
-            ['address'=>'chensj@zw88.net','name'=>'chensj'],
-            ['address'=>'sijj@yqsd.net','name'=>'sijj'],
-            ['address'=>'yuyy@yqsd.net','name'=>'俞焰艳'],
-            ['address'=>'panxp@zw88.net','name'=>'潘霞萍']
-        );
-        SendStatsEmailService::SendHtmlEmailWithAcce($to_user,['subject'=>"上周( $beginLastweek 至 $endLastweek )外部派单作品分析报表",'body'=>$html],storage_path('app/last_week_send_order.xlsx'));
-    }
-
-    private function getSuperiorBooks() {
-        $data = SendStatsEmailService::getOrderStatsNew();
-
-        $page = view('email.daySendOrderStats',['datas'=>$data]);
-        $html = response($page)->getContent();
-        //\Log::info($html);
-        $data_temp = array();
-        $header = ['书籍ID','书籍名称','是否下架','篇幅','24小时uv','24小时充值总额','72小时uv','72小时充值总额','uv','24~72小时充值增长','24小时充值比24小时UV','72小时充值比24小时UV','强关率'];
-        foreach ($data as $k=>$item) {
-            $title='';
-            switch ($k){
-                case 0:$title='注册UV比高于85%';break;
-                //case 1:$title='注册UV比介于30%到85%';break;
-                case 1:$title='注册UV比低于30%';break;
-            }
-            $temp = array('header'=>$header,'title'=>$title,'data'=>array());
-            foreach ($item as $key=>$value) {
-                $temp['data'][] = array(
-                    $value['bid'],
-                    $value['book_name'],
-                    $value['is_on_shelf']==1?'内部上架':'外部上架',
-                    $value['charge_type']=='BOOK'?'短篇':'长篇',
-                    $value['uv_one_day_sum'],
-                    $value['recharge_amount_in_one_day'],
-                    $value['uv_three_day_sum'],
-                    $value['recharge_amount_in_three_days'],
-                    $value['UV'],
-                    $value['recharge_amount_in_one_day']>0?round(($value['recharge_amount_in_three_days']-$value['recharge_amount_in_one_day'])/$value['recharge_amount_in_one_day'],2):0,
-                    $value['uv_one_day_sum']>0?round(($value['recharge_amount_in_one_day']/$value['uv_one_day_sum']),2):0,
-                    //$value['uv_three_day_sum']>0?round(($value['recharge_amount_in_three_days']/$value['uv_three_day_sum']),2):0,
-                    $value['uv_one_day_sum']>0?round(($value['recharge_amount_in_three_days']/$value['uv_one_day_sum']),2):0,
-                    $value['register_user_sum']>0?(round(($value['force_user_sum']/$value['register_user_sum']),4)*100).'%':0,
-
-                );
-            }
-            $data_temp[] = $temp;
-        }
-        saveExcelDataToMultiSheet($data_temp,storage_path('app/last_week_send_order.xlsx'));
-
-        $to_user = array(
-            ['address'=>'zhangzg@iqiyoo.com','name'=>'张总'],
-            //['address'=>'1373617746@qq.com','name'=>'tusx'],
-            ['address'=>'1298192057@qq.com','name'=>'刘杰'],
-            ['address'=>'chensj@zw88.net','name'=>'陈帅君'],
-            ['address'=>'zhaojp@yqsd.net','name'=>'赵君平'],
-
-            ['address'=>'panxp@zw88.net','name'=>'潘霞萍']
-        );
-        SendStatsEmailService::SendHtmlEmailWithAcce($to_user,['subject'=>date('Y-m-d',strtotime('-1 day'))."优质书外部派单分析报表",'body'=>$html],storage_path('app/last_week_send_order.xlsx'));
-    }
-}

+ 0 - 188
app/Console/Commands/SendOrder/SetExtraStats.php

@@ -1,188 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: sogndb
- * Date: 2018/02/05
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands\SendOrder;
-
-use Log;
-use Illuminate\Console\Command;
-use App\Modules\SendOrder\Services\SendOrderService;
-use App\Modules\Statistic\Services\WapVisitStatService;
-use DB;
-use Redis;
-
-class SetExtraStats extends Command
-{
-    /**
-     * 执行命令   php artisan send_order:set_extra_stats
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'send_order:set_extra_stats';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '派单额外数据uv24小时设置';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        ini_set('memory_limit', '1024M');
-        print_r('memory_used:'.memory_get_usage()."\n");
-        print_r("======派单额外数据uv24小时设置 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        Log::info("======派单额外数据uv24小时设置 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        $start = date('Y-m-d H:i:s',strtotime('-1 day') - 120);
-        $end = date('Y-m-d H:i:s',strtotime($start)+240);
-        collect(DB::select("select send_orders.id,send_orders.send_time,uv_one_day from send_orders left join send_order_extra_stats on send_order_extra_stats.send_order_id = send_orders.id where send_orders.send_time >= '{$start}' and send_orders.send_time <= '{$end}'"))->each(function ($send_order){
-            if($send_order->uv_one_day === null)
-            {
-                $uv_one_day = $this->getOneDayUv($send_order->id);
-                $pv_one_day = $this->getOneDayPv($send_order->id);
-                $time = date('Y-m-d H:i:s');
-                $data = [
-                    'uv_one_day'=>$uv_one_day,
-                    'pv_one_day'=>$pv_one_day,
-                    'send_order_id'=>$send_order->id,
-                    'send_time'=>$send_order->send_time,
-                    'created_at'=>$time,
-                    'updated_at'=>$time
-                ];
-                DB::table('send_order_extra_stats')->insert($data);
-            }
-        });
-
-        $start = date('Y-m-d H:i:s',strtotime('-3 days') - 120);
-        $end = date('Y-m-d H:i:s',strtotime($start)+240);
-        collect(DB::select("select send_orders.id,send_orders.send_time,send_order_extra_stats.id as extra_id,uv_three_day from send_orders left join send_order_extra_stats on send_order_extra_stats.send_order_id = send_orders.id where send_orders.send_time >= '{$start}' and send_orders.send_time <= '{$end}'"))->each(function ($send_order){
-            if($send_order->uv_three_day === null)
-            {
-                $uv_three_day = $this->getThreeDayUv($send_order->id);
-                $pv_three_day = $this->getThreeDayPv($send_order->id);
-                $time = date('Y-m-d H:i:s');
-                $data = [
-                    'uv_three_day'=>$uv_three_day,
-                    'pv_three_day'=>$pv_three_day,
-                    'updated_at'=>$time
-                ];
-                DB::table('send_order_extra_stats')->where('id',$send_order->extra_id)->update($data);
-            }
-        });
-
-        Log::info("======派单额外数据uv24小时设置 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-        print_r("======派单额外数据uv24小时设置 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-        print_r('memory_used:'.memory_get_usage()."\n");
-    }
-
-    //采集24小时uv
-    private function getOneDayUv($id)
-    {
-        $today = date('Y-m-d');
-        $yesterday = date('Y-m-d',strtotime('-1 day'));
-
-        $one_day_uv = 0;
-        $redis_uv = Redis::hgetall('send_order_uv_'. $id);
-        $one_day_uv += isset($redis_uv[$today]) ? (int)$redis_uv[$today] : 0;//当天从redis获取
-
-        $yesterday_uv = isset($redis_uv[$yesterday]) ? (int)$redis_uv[$yesterday] : 0;
-        if(!$yesterday_uv)
-        {
-            //从数据库中获取v
-            $yesterday_uv_pv = WapVisitStatService::getSendOrderDayUvPvFromStat($id, $yesterday);
-            $yesterday_uv = $yesterday_uv_pv['uv'];
-        }
-        $one_day_uv += $yesterday_uv;
-        return $one_day_uv;
-    }
-
-    //采集24小时pv
-    private function getOneDayPv($id)
-    {
-        $today = date('Y-m-d');
-        $yesterday = date('Y-m-d',strtotime('-1 day'));
-
-        $one_day_pv = 0;
-        $redis_pv = Redis::hgetall('send_order_pv_'. $id);
-        $one_day_pv += isset($redis_pv[$today]) ? (int)$redis_pv[$today] : 0;//当天从redis获取
-
-        $yesterday_pv = isset($redis_pv[$yesterday]) ? (int)$redis_pv[$yesterday] : 0;
-        if(!$yesterday_pv)
-        {
-            //从数据库中获取
-            $yesterday_uv_pv = WapVisitStatService::getSendOrderDayUvPvFromStat($id, $yesterday);
-            $yesterday_pv = $yesterday_uv_pv['pv'];
-        }
-        $one_day_pv += $yesterday_pv;
-        return $one_day_pv;
-    }
-
-    //采集72小时uv
-    private function getThreeDayUv($id)
-    {
-        $today = date('Y-m-d');
-        $yesterday = date('Y-m-d',strtotime('-1 day'));
-        $the_day_before_yesterday = date('Y-m-d',strtotime('-2 day'));
-        $three_days_ago = date('Y-m-d',strtotime('-3 day'));
-
-        $one_day_uv = 0;
-        $redis_uv = Redis::hgetall('send_order_uv_'. $id);
-        $one_day_uv += isset($redis_uv[$today]) ? (int)$redis_uv[$today] : 0;//当天从redis获取
-
-        $yesterday_uv = isset($redis_uv[$yesterday]) ? (int)$redis_uv[$yesterday] : 0;
-        if(!$yesterday_uv)
-        {
-            //从数据库中获取v
-            $yesterday_uv_pv = WapVisitStatService::getSendOrderDayUvPvFromStat($id, $yesterday);
-            $yesterday_uv = $yesterday_uv_pv['uv'];
-        }
-        $one_day_uv += $yesterday_uv;
-
-        $the_day_before_yesterday_uv_pv = WapVisitStatService::getSendOrderDayUvPvFromStat($id, $the_day_before_yesterday);
-        $one_day_uv += $the_day_before_yesterday_uv_pv['uv'];
-        $three_days_ago_uv_pv = WapVisitStatService::getSendOrderDayUvPvFromStat($id, $three_days_ago);
-        $one_day_uv += $three_days_ago_uv_pv['uv'];
-        return $one_day_uv;
-    }
-
-    //采集72小时pv
-    private function getThreeDayPv($id)
-    {
-        $today = date('Y-m-d');
-        $yesterday = date('Y-m-d',strtotime('-1 day'));
-        $the_day_before_yesterday = date('Y-m-d',strtotime('-2 days'));
-        $three_days_ago = date('Y-m-d',strtotime('-3 days'));
-
-        $one_day_pv = 0;
-        $redis_pv = Redis::hgetall('send_order_pv_'. $id);
-        $one_day_pv += isset($redis_pv[$today]) ? (int)$redis_pv[$today] : 0;//当天从redis获取
-
-        $yesterday_pv = isset($redis_pv[$yesterday]) ? (int)$redis_pv[$yesterday] : 0;
-        if(!$yesterday_pv)
-        {
-            //从数据库中获取
-            $yesterday_uv_pv = WapVisitStatService::getSendOrderDayUvPvFromStat($id, $yesterday);
-            $yesterday_pv = $yesterday_uv_pv['pv'];
-        }
-        $one_day_pv += $yesterday_pv;
-
-        $the_day_before_yesterday_uv_pv = WapVisitStatService::getSendOrderDayUvPvFromStat($id, $the_day_before_yesterday);
-        $one_day_pv += $the_day_before_yesterday_uv_pv['pv'];
-        $three_days_ago_uv_pv = WapVisitStatService::getSendOrderDayUvPvFromStat($id, $three_days_ago);
-        $one_day_pv += $three_days_ago_uv_pv['pv'];
-        return $one_day_pv;
-    }
-
-}

+ 0 - 84
app/Console/Commands/SendOrder/UserActivityStats.php

@@ -1,84 +0,0 @@
-<?php
-/**
-用户活跃统计
- */
-
-namespace App\Console\Commands\SendOrder;
-
-use Log;
-use Illuminate\Console\Command;
-use App\Modules\User\Services\ReadRecordService;
-use App\Modules\User\Services\UserService;
-
-use DB;
-
-class UserActivityStats extends Command
-{
-    /**
-     * 执行命令   php artisan SendOrder:userActivityStat
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'SendOrder:userActivityStat  {loop} {loop_add}';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '月活统计';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        ini_set('memory_limit', '1024M');
-        print_r('memory_used:'.memory_get_usage()."\n");
-        print_r("======月活统计【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        
-        $base_loop = $loop = $this->argument('loop');
-        $loop_add = $this->argument('loop_add');
-        
-        $one_month_ago = strtotime(date('Y-m-d'))-30*24*3600;
-        $start = date('Y-m-d',strtotime('-30 day'));
-        $end = date('Y-m-d');
-        
-        
-        $loop_end = $loop+$loop_add;
-        $limit = 10000;
-        $active_user_num = 0;
-        \Log::info('userActivityStat_start:loop:'.$loop.' active_user_num:'.$active_user_num);
-        
-        while($loop < 3000 && $loop < $loop_end){
-        	// 获取用户,每次1w
-        	$offset = $limit*($loop-1);
-        	$users = UserService::getUserList($limit,$offset);
-        	if(is_null($users)){
-        		\Log::info('userActivityStat_break:base_loop:'.$base_loop.' loop:'.$loop.' active_user_num:'.$active_user_num);
-        		break;
-        	}
-        	foreach($users as $user){
-        		// 获取最近阅读时间
-        		$read_recodes = ReadRecordService::getReadRecord($user->id);
-//         		\Log::info($read_recodes);
-        		$last_read_time = isset($read_recodes[0]['time'])?$read_recodes[0]['time']:'0';
-        		//\Log::info('last_read_time:'.$last_read_time.' one_month_ago:'.$one_month_ago);
-        		// 如果再一个月内
-        		if($last_read_time > 0 && $last_read_time > $one_month_ago){
-        			$active_user_num ++;
-        		}
-        	}
-        	\Log::info('userActivityStat:loop:base_loop:'.$base_loop.' loop:'.$loop.' active_user_num:'.$active_user_num);
-        	$loop++;
-        }
-        \Log::info('userActivityStat_end_base_loop:'.$base_loop.' loop:'.$loop.' active_user_num:'.$active_user_num);
-        
-        print_r("======月活统计 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-        print_r('memory_used:'.memory_get_usage()."\n");
-    }
-}

+ 0 - 59
app/Console/Commands/SendOrderBreakevenForceUser.php

@@ -1,59 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use DB;
-class SendOrderBreakevenForceUser extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'sendorderbreadforceuser';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '更新粉丝数';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $this->start();
-    }
-
-    public function start(){
-        DB::table('send_order_breakeven_stats')->select('id','official_account_id','date')->where('date','=',date('Y-m-d',time()-86400))->orderBy('id')->chunk(1000,function ($res){
-            foreach ($res as $v){
-                $appid = DB::table('official_accounts')->where('id',$v->official_account_id)->select('appid')->first();
-                if($appid && isset($appid->appid)){
-                    $total = DB::table('force_subscribe_users')->where('is_subscribed',1)->where('appid',$appid->appid)->count();
-                    $today = DB::table('force_subscribe_users')
-                        ->where('appid',$appid->appid)
-                        ->where('created_at','>=',$v->date)
-                        ->where('created_at','<=',$v->date.' 23:59:59')
-                        ->count();
-                    DB::table('send_order_breakeven_stats')->where('id',$v->id)->update(['total_force_user_num'=>$total,'force_user_num'=>$today]);
-                }
-            }
-        });
-    }
-}

+ 0 - 53
app/Console/Commands/SendServiceMsg.php

@@ -1,53 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use App\Modules\OfficialAccount\Services\CustomMsgService;
-class SendServiceMsg extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'sendservicemsg';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '发送客服消息';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $this->sendStart();
-        $this->sendStartPoint();
-    }
-
-    
-    public function sendStart(){
-        CustomMsgService::add_news_top_book();
-    }
-
-    public function sendStartPoint(){
-        CustomMsgService::add_news_point_book();
-    }
-
-}

+ 0 - 133
app/Console/Commands/SignReward.php

@@ -1,133 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use App\Modules\User\Services\UserSignService;
-use Illuminate\Console\Command;
-use DB;
-use Redis;
-use App\Jobs\SendTexts;
-use App\Modules\User\Services\ReadRecordService;
-use App\Modules\User\Services\UserService;
-use App\Modules\Book\Services\BookConfigService;
-use Hashids;
-use App\Modules\Activity\Models\Activity;
-use App\Modules\Activity\Services\ActivityService;
-class SignReward extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'sign:reward {--record}';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '签到奖励';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $option = $this->option('record');
-        if($option){
-            $this->signRecord();
-        }else{
-            $this->signPushMsg();
-        }
-    }
-
-    public function saveSignInfoAndReward($option)
-    {
-        if ($option) {
-            $sign_key = 'sign-' . date('Y-m-d', time() - 86400);
-        } else {
-            $sign_key = 'sign-' . date('Y-m-d');
-        }
-        //print_r($sign_key);
-        //return 1;
-        $res = Redis::hgetall($sign_key);
-        $sign_data = [];
-        $uid_arr = [];
-        if (!$res) return -1;
-
-        foreach ($res as $key => $v) {
-            if (Redis::SISMEMBER($sign_key, $key)) {
-                continue;
-            }
-            $uid_arr[] = $key;
-            $sign_data[] = ['uid' => $key, 'price' => 50, 'sign_time' => $v, 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')];
-            Redis::sadd($sign_key, $key);
-        }
-        DB::table('user_sign')->insert($sign_data);
-        DB::table('users')->whereIn('id', $uid_arr)->increment('balance', 50);
-        DB::table('users')->whereIn('id', $uid_arr)->increment('reward_balance', 50);
-        return 0;
-    }
-
-    public function signRecord(){
-        DB::table('order_day_stats')->select('id', 'distribution_channel_id', 'date')->where('date',date('Y-m-d',time()-86400))->orderBy('id')->chunk(1000, function ($res) {
-            foreach ($res as $v) {
-                $sql = "select count(*) as count from user_sign join users on user_sign.uid=users.id where date(user_sign.created_at)='%s' and user.distribution_channel_id=%s";
-                $user_sign_info = DB::select($sql);
-                DB::table('order_day_stats')->where('id',$v->id)->update([
-                    'sign_num'=>(int)$user_sign_info[0]->count
-                ]);
-            }
-        });
-    }
-
-    public function signPushMsg()
-    {
-        $sign_key = 'leyuee:wap:usersigni';
-        //Redis::sadd($sign_key, 9);
-        $records = Redis::hgetall($sign_key);
-        if ($records ) {
-            //$uids = Redis::SMEMBERS($sign_key);
-            Redis::del($sign_key);
-            $uids = [];
-            foreach ($records as $u=>$p){
-                $uids[] = $u;
-            }
-            if (empty($uids)) return false;
-            $subscribe_user = DB::table('force_subscribe_users')->whereIn('uid', $uids)->where('is_subscribed', 1)->select('uid', 'appid', 'openid', 'distribution_channel_id')->get();
-            if ($subscribe_user) {
-                $delay = 0;
-                foreach ($subscribe_user as $keys => $value) {
-                    $content = UserSignService::userSignReturnContent3($value->openid);
-                    $data['openid'] = $value->openid;
-                    $data['appid'] = $value->appid;
-                    $data['content'] = $content;
-                    $data['type'] = 'one_task';
-                    $data['send_time'] = date("Y-m-d H:i:s");
-                    $data['task_id'] = md5(123);
-                    $send_data = array(
-                        'send_time' => date("Y-m-d H:i:s"),
-                        'data' => $data
-                    );
-                    //print_r($send_data);
-                    dispatch((new SendTexts($send_data))->onConnection('rabbitmq')->delay($delay)->onQueue('send_texts_list'));
-                }
-            }
-            return false;
-        }
-        return false;
-    }
-}

+ 0 - 47
app/Console/Commands/SmartPush/AllPushHotBook.php

@@ -1,47 +0,0 @@
-<?php
-
-namespace App\Console\Commands\SmartPush;
-
-use Illuminate\Console\Command;
-use App\Modules\OfficialAccount\Services\CustomMsgService;
-class AllPushHotBook extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'SmartPush:AllPushHotBook';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '已付费推送热门书籍';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-    	$this->all_push_hot_book();
-    }
-
-    public function all_push_hot_book(){
-    	CustomMsgService::SmartPush('all_hot_push');
-    }
-
-}

+ 0 - 47
app/Console/Commands/SmartPush/LongChapterCustom.php

@@ -1,47 +0,0 @@
-<?php
-
-namespace App\Console\Commands\SmartPush;
-
-use Illuminate\Console\Command;
-use App\Modules\OfficialAccount\Services\CustomMsgService;
-class LongChapterCustom extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'SmartPush:LongChapterCustom';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '推送长篇客服';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-//     	$this->LongChapterCustom();
-    }
-
-    public function LongChapterCustom(){
-    	CustomMsgService::SimpleSmartPush('custom_short_long_chapter');
-    }
-
-}

+ 0 - 48
app/Console/Commands/SmartPush/LongChapterTemplate.php

@@ -1,48 +0,0 @@
-<?php
-
-namespace App\Console\Commands\SmartPush;
-
-use Illuminate\Console\Command;
-use App\Modules\OfficialAccount\Services\CustomMsgService;
-class LongChapterTemplate extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'SmartPush:LongChapterTemplate';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '推送长篇模板';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-    	// 暂停
-//     	$this->LongChapterTemplate();
-    }
-
-    public function LongChapterTemplate(){
-    	CustomMsgService::SimpleSmartPush('template_short_long_chapter');
-    }
-
-}

+ 0 - 47
app/Console/Commands/SmartPush/PaidPushPointBook.php

@@ -1,47 +0,0 @@
-<?php
-
-namespace App\Console\Commands\SmartPush;
-
-use Illuminate\Console\Command;
-use App\Modules\OfficialAccount\Services\CustomMsgService;
-class PaidPushPointBook extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'SmartPush:PaidPushPointBook';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '已付费推送定制书籍';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-    	$this->paid_push_point_book();
-    }
-
-    public function paid_push_point_book(){
-    	CustomMsgService::SmartPush('paid_point_push');
-    }
-
-}

+ 0 - 47
app/Console/Commands/SmartPush/PaidUserCustom.php

@@ -1,47 +0,0 @@
-<?php
-
-namespace App\Console\Commands\SmartPush;
-
-use Illuminate\Console\Command;
-use App\Modules\OfficialAccount\Services\CustomMsgService;
-class PaidUserCustom extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'SmartPush:PaidUserCustom';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '已付费用户6小时后推送客服消息';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-    	$this->pay_user_custom();
-    }
-
-    public function pay_user_custom(){
-    	CustomMsgService::SmartPush('pay_daily_push');
-    }
-
-}

+ 0 - 47
app/Console/Commands/SmartPush/UnPaidPushHotBook.php

@@ -1,47 +0,0 @@
-<?php
-
-namespace App\Console\Commands\SmartPush;
-
-use Illuminate\Console\Command;
-use App\Modules\OfficialAccount\Services\CustomMsgService;
-class UnPaidPushHotBook extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'SmartPush:UnPaidPushHotBook';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '未付费推送热门书籍';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-    	$this->unpaid_push_hot_book();
-    }
-
-    public function unpaid_push_hot_book(){
-    	CustomMsgService::SmartPush('unpaid_hot_push');
-    }
-
-}

+ 0 - 47
app/Console/Commands/SmartPush/UnPaidPushPointBook.php

@@ -1,47 +0,0 @@
-<?php
-
-namespace App\Console\Commands\SmartPush;
-
-use Illuminate\Console\Command;
-use App\Modules\OfficialAccount\Services\CustomMsgService;
-class UnPaidPushPointBook extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'SmartPush:UnPaidPushPointBook';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '未付费推送定制书籍';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-    	$this->unpaid_push_point_book();
-    }
-
-    public function unpaid_push_point_book(){
-    	CustomMsgService::SmartPush('unpaid_point_push');
-    }
-
-}

+ 0 - 46
app/Console/Commands/SmartPush/UnPaidUserBigActivity.php

@@ -1,46 +0,0 @@
-<?php
-
-namespace App\Console\Commands\SmartPush;
-
-use Illuminate\Console\Command;
-use App\Modules\OfficialAccount\Services\CustomMsgService;
-class UnPaidUserBigActivity extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'SmartPush:UnPaidUserBigActivity';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '未支付新用户优惠充值活动(更多充值选项 )';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $this->unPaidUserBigActivity();
-    }
-
-    public function unPaidUserBigActivity(){
-        CustomMsgService::SmartPush('unpaid_send_big_activity');
-    }
-}

+ 0 - 46
app/Console/Commands/SmartPush/UnPaidUserSmallActivity.php

@@ -1,46 +0,0 @@
-<?php
-
-namespace App\Console\Commands\SmartPush;
-
-use Illuminate\Console\Command;
-use App\Modules\OfficialAccount\Services\CustomMsgService;
-class UnPaidUserSmallActivity extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'SmartPush:UnPaidUserSmallActivity';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '未支付新用户9.9充值活动';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $this->unPaidUserActivity();
-    }
-
-    public function unPaidUserActivity(){
-    	CustomMsgService::SmartPush('unpaid_send_activity');
-    }
-}

+ 0 - 116
app/Console/Commands/Sub/GenerateCpSubDayStat.php

@@ -1,116 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: songdb
- * Date: 2017/12/26
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands\Sub;
-
-use Log;
-use Illuminate\Console\Command;
-use DB;
-
-class GenerateCpSubDayStat extends Command
-{
-    /**
-     * 执行命令   php artisan generate_order_day_stat
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'generate_cp_sub_day_stat';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = 'CP日订阅统计数据生成';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        print_r("======CP日订阅统计数据生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        Log::info("======CP日订阅统计数据生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        $cps = [
-            'mianhua','guijj'
-        ];
-
-        $end_date = "2018-01-01";
-
-        foreach ($cps as $cp)
-        {
-            $data = [];
-            //取cp下所有bid
-            $books = DB::select("select bid,books.name from books,book_configs where books.id = book_configs.bid and cp_source = '{$cp}' ");
-
-            dump('books');dump($books);
-
-            $book_data = [];
-            foreach ($books as $book)
-            {
-                $book_data[$book->bid] = $book->name;
-                $data[$book->bid]['book_name'] = $book->name;
-                $data[$book->bid]['count'] = 0;
-                $data[$book->bid]['charge_balance'] = 0;
-                $data[$book->bid]['book_count'] = 0;
-                $data[$book->bid]['book_charge_balance'] = 0;
-            }
-
-            dump('book_data');dump($book_data);
-
-            $bids = implode(',',array_keys($book_data));
-
-            dump('bids');dump($bids);
-
-            //遍历所有订阅表查寻章节订购数、金额
-            for($i=0;$i<512;$i++)
-            {
-                $table_datas = DB::connection('chapter_order_mysql')->select("select bid,count(1) count,sum(charge_balance) charge_balance from chapter_orders{$i} where created_at <'{$end_date}' and bid in ({$bids}) group by bid");
-
-                foreach ($table_datas as $item)
-                {
-                    $data[$item->bid]['count'] += $item->count;
-                    $data[$item->bid]['charge_balance'] += $item->charge_balance;
-                }
-            }
-
-            $charge_book_data = DB::select("select bid,count(1) count,sum(charge_balance) charge_balance from book_orders where created_at <'{$end_date}' and bid in ({$bids}) group by bid");
-            foreach ($charge_book_data as $item_book)
-            {
-                $data[$item_book->bid]['book_count'] += $item_book->count;
-                $data[$item_book->bid]['book_charge_balance'] += $item_book->charge_balance;
-            }
-
-            foreach ($data as $bid=>$_item)
-            {
-                $_data = [
-                    'date'=>'2017-12-12',
-                    'cp_name'=>$cp,
-                    'bid'=>$bid,
-                    'book_name'=>$book_data[$bid],
-                    'book_name'=>$book_data[$bid],
-                    'chapter_sub_num'=>$_item['count'],
-                    'chapter_sub_amount'=>$_item['charge_balance'],
-                    'book_sub_num'=>$_item['book_count'],
-                    'book_sub_amount'=>$_item['book_charge_balance']
-                ];
-                DB::table('cp_day_subs')->insert($_data);
-            }
-
-        }
-
-
-        Log::info("======CP日订阅统计数据生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-        print_r("======CP日订阅统计数据生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-    }
-}

+ 0 - 123
app/Console/Commands/SubscribeAlert.php

@@ -1,123 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use App\Libs\SMS;
-use Illuminate\Support\Facades\Cache;
-use DB;
-class SubscribeAlert extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'subscribealert {--type=}';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '粉丝和强关预警';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $type = $this->option('type');
-        if($type == 'getTopAlert'){
-            $this->getTopAlert();
-        }
-        if($type == 'subscribeRateAlert'){
-            $this->subscribeRateAlert();
-        }
-    }
-
-    /**
-     * 商户平台日粉丝到达上限90%、达到总上限90%
-     */
-    private function getTopAlert(){
-        $sql = "SELECT distribution_channel_id,GROUP_CONCAT(nickname)as nickname,GROUP_CONCAT(appid) as appid,SUM(subscribe_day_maximum) as `max` FROM official_accounts WHERE is_auth = 1 and is_enabled = 1 GROUP BY distribution_channel_id";
-        $res = DB::select($sql);
-        foreach ($res as $v){
-            $count = DB::table('force_subscribe_users')
-                ->whereIn('appid',explode(',',$v->appid))
-                ->where('is_subscribed',1)
-                ->where('created_at','>=',date('Y-m-d'))
-                ->where('created_at','<',date('Y-m-d',time()+86400))
-                ->count();
-            if($count>= $v->max*0.9){
-                $key = date('Y-m-d').'-distribution_channel_id-'.$v->distribution_channel_id;
-                $old = Cache::store('file')->get($key);
-
-                if($old){
-                    continue;
-                }else{
-                    Cache::store('file')->put($key,time(),24*60);
-                    $content = '强关峰值预警,渠道'.$v->distribution_channel_id.'日粉丝到达上限90%,公众号:'.$v->nickname;
-                    $this->send($content);
-                }
-            }
-            return;
-        }
-    }
-
-    private function send($content){
-        //(君平15858178353  张总 13858057394  刘杰18457087995     陈帅军15088790066  斯嘉杰 18072713392 zw 186.. 栋波15868100210 )
-        $phones = ['15858178353','13858057394','18457087995','15088790066','18072713392','18668029091','15868100210'];
-        //$phones = ['18668029091'];
-        foreach ($phones as $phone){
-            SMS::send($phone,$content);
-        }
-    }
-
-    public function subscribeRateAlert(){
-
-        $key = 'getSubscribeRate';
-        $old = Cache::store('file')->get($key);
-        if($old){
-            return;
-        }
-        $now_hour = date('G');
-        //echo '$now_hour--'.$now_hour.PHP_EOL;
-        $rate = $this->getSubscribeRate();
-        //echo '$tate is:'.$rate.PHP_EOL;
-        if($now_hour>=4 &&  $now_hour<=7){
-            if($rate < 0.2){
-                $content = '平台强关率预警,当前强关率'.$rate;
-                $this->send($content);
-                Cache::store('file')->put($key,time(),60*3);
-            }
-        }else{
-            if($rate < 0.25){
-                $content = '平台强关率预警,当前强关率'.$rate;
-                $this->send($content);
-                Cache::store('file')->put($key,time(),60*3);
-            }
-        }
-    }
-
-    private function getSubscribeRate(){
-        $register_user_num = DB::table('users')->where('created_at','>=',date('Y-m-d H',time()-3600))->where('created_at','<',date('Y-m-d H'))->count();
-        $force_subscribe_users_num = DB::table('force_subscribe_users')->where('created_at','>=',date('Y-m-d H',time()-3600))->where('created_at','<',date('Y-m-d H'))->count();
-        if($register_user_num == 0){
-            return 0;
-        }
-        return round($force_subscribe_users_num/$register_user_num,2);
-    }
-}

+ 0 - 116
app/Console/Commands/SubscribeDataStats.php

@@ -1,116 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use DB;
-use Log;
-class SubscribeDataStats extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'book:subds {--all}';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = 'Command description';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $options = $this->option('all');
-        if($options){
-            $this->resetAll();
-        }else{
-            $this->start();
-        }
-    }
-
-    private function _update($data){
-        $sql_fromat = 'select sum(sum_fee) as sum_fee, sum(sum_charge_balance) as sum_charge_balance, sum(sum_reward_balance) as sum_reward_balance from sub_bak5 where bid=%s and send_order_id=%s';
-        $sql = sprintf($sql_fromat,$data['bid'],$data['send_order_id']);
-        $chapter = DB::connection('chapter_order_mysql')->select($sql);
-
-        $sqls_fromat = 'select sum(fee) as sum_fee, sum(charge_balance) as sum_charge_balance, sum(reward_balance) as sum_reward_balance from book_orders where bid=%s and send_order_id=%s';
-        $sqls = sprintf($sqls_fromat,$data['bid'],$data['send_order_id']);
-        $book = DB::select($sqls);
-
-        $total_fee = 0;
-        $charge_balance = 0;
-        $rewrad_blance = 0;
-        if($chapter && isset($chapter[0])){
-            $total_fee += (int)$chapter[0]->sum_fee;
-            $charge_balance += (int)$chapter[0]->sum_charge_balance;
-            $rewrad_blance += (int)$chapter[0]->sum_reward_balance;
-        }
-
-        if($book && isset($book[0])){
-            $total_fee += (int)$book[0]->sum_fee;
-            $charge_balance += (int)$book[0]->sum_charge_balance;
-            $rewrad_blance += (int)$book[0]->sum_reward_balance;
-        }
-
-        DB::table('send_orders_stats')->where('id',$data['id'])->update([
-            'sum_fee'=>$total_fee,
-            'sum_charge_balance'=>$charge_balance,
-            'sum_reward_balance'=>$rewrad_blance
-        ]);
-    }
-
-    public function start(){
-        $date = date('Y-m-d',time()-86400);
-        $sql_fromat = 'select bid,send_order_id,sum(sum_fee) as sum_fee, sum(sum_charge_balance) as sum_charge_balance, sum(sum_reward_balance) as sum_reward_balance from sub_bak5 where date="%s"  group BY bid,send_order_id ';
-        $sql = sprintf($sql_fromat,$date);
-        $chapter = DB::connection('chapter_order_mysql')->select($sql);
-
-        foreach ($chapter as $c){
-            $update_temp = 'update send_orders_stats set sum_fee=sum_fee+'.(int)$c->sum_fee.', sum_charge_balance=sum_charge_balance+'.(int)$c->sum_charge_balance.',sum_reward_balance=sum_reward_balance+'.(int)$c->sum_reward_balance.' where bid='.(int)$c->bid.' and send_order_id='.(int)$c->send_order_id;
-            DB::update($update_temp);
-        }
-        $sqls_fromat = 'select bid,send_order_id,sum(fee) as sum_fee, sum(charge_balance) as sum_charge_balance, sum(reward_balance) as sum_reward_balance from book_orders where date(created_at)="%s"  GROUP BY bid,send_order_id';
-        $sqls = sprintf($sqls_fromat,$date);
-        $book = DB::select($sqls);
-
-        foreach ($book as $b){
-            $update_temp = 'update send_orders_stats set sum_fee=sum_fee+'.(int)$b->sum_fee.', sum_charge_balance=sum_charge_balance+'.(int)$b->sum_charge_balance.',sum_reward_balance=sum_reward_balance+'.(int)$b->sum_reward_balance.' where bid='.(int)$b->bid.' and send_order_id='.(int)$b->send_order_id;
-            DB::update($update_temp);
-        }
-    }
-
-    public function resetAll()
-    {
-        DB::table('send_orders_stats')->select('id', 'send_order_id', 'bid')->orderBy('id')->chunk(1000, function ($res) {
-            foreach ($res as $v) {
-                if ($v->send_order_id && $v->bid) {
-                    $this->_update([
-                        'id' => $v->id,
-                        'send_order_id' => $v->send_order_id,
-                        'bid' => $v->bid
-                    ]);
-                }
-            }
-        });
-    }
-
-
-}

+ 0 - 64
app/Console/Commands/SuperiorBooks/DailyScanForSupriorNewBook.php

@@ -1,64 +0,0 @@
-<?php
-
-namespace App\Console\Commands\SuperiorBooks;
-
-use App\Modules\Book\Services\SuperiorNewBookService;
-use DB;
-use Illuminate\Console\Command;
-
-class DailyScanForSupriorNewBook extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'addSuperiorBook';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '扫描新上架优质书,加入榜单';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        //
-        $month_ago = date('Y-m-d',strtotime(' -30 day'));
-        $new_books = DB::table('book_configs as bc')
-                ->leftjoin('books as b','b.id','=','bc.bid')
-                ->leftjoin('book_categories as bcs','bcs.id','=','b.category_id')
-                ->select('bc.bid','bcs.pid','b.category_id','bc.recommend_index')
-                ->where([
-                    ['bc.created_at','>=',$month_ago.' 00:00:00'],
-                    ['bc.created_at','<=',date('Y-m-d')],
-                    ['bc.recommend_index','>=',90]
-                ])
-                ->orderBy('bc.created_at','asc')
-                ->get();
-        \Log::info('new_books:'.json_encode($new_books));
-        foreach ($new_books as $new_book){
-            try{
-                SuperiorNewBookService::addSuperiorItem($new_book);
-            }catch (\Exception $e){
-                \Log::error('优质新书库加入失败!'.($e->getMessage()));
-            }
-        }
-    }
-}

+ 0 - 47
app/Console/Commands/SuperiorBooks/HistorySupriorBook.php

@@ -1,47 +0,0 @@
-<?php
-
-namespace App\Console\Commands\SuperiorBooks;
-
-use App\Modules\Book\Services\SuperiorHistoryBookService;
-use DB;
-use Illuminate\Console\Command;
-
-class HistorySupriorBook extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'addHistorySuperiorBook';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '扫描历史书库';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        //
-        SuperiorHistoryBookService::selectHistoryBooks();
-        SuperiorHistoryBookService::selectMaleSuperiorBooks();
-
-    }
-}

+ 0 - 132
app/Console/Commands/SuperiorBooks/TempCommand.php

@@ -1,132 +0,0 @@
-<?php
-
-namespace App\Console\Commands\SuperiorBooks;
-
-use App\Modules\Book\Services\SuperiorHistoryBookService;
-use App\Modules\Channel\Models\CompanySpecialBook;
-use DB;
-use Illuminate\Console\Command;
-
-class TempCommand extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'TemporaryCommand {scene}';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '临时任务';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        //$array = ['recent_read','subscribe','text_sign','text_search','readerover','readrecord','daily_sign'];//
-
-//        $array = ['daily_sign'];
-
-        //foreach ($array as $v) {
-        $books = DB::table('superior_history_books')->where('status',1)->get();
-        foreach ($books as $book){
-            DB::table('chapter')->where()->first();
-        }
-        return true;
-        $v = $this->argument('scene');
-             DB::connection('chapter_order_mysql')
-                ->table($v.'_user_sub')
-                 ->orderBy('id')
-                ->where('fee', -1)->chunk(10000, function ($users) use($v){
-                    foreach ($users as $user) {
-                        $fee = DB::connection('chapter_order_mysql')->table('chapter_orders' . (($user->uid) % 512))
-                            ->where('uid', $user->uid)
-                            ->where('created_at', '<=', '2018-12-07 23:59:59')
-                            ->sum('fee');
-                        DB::connection('chapter_order_mysql')
-                            ->table($v.'_user_sub')
-                            ->where('uid',$user->uid)
-                            ->update(['fee'=>$fee]);
-                    }
-                });
-        //}
-        return;
-        //
-       /* $companies = DB::table('companies')->where('is_important',1)->get();
-        $internal_books = DB::table('book_configs')->where('is_on_shelf',1)->get();
-        foreach ($companies as $company) {
-            foreach ($internal_books as $internal_book){
-                $data = ['bid'=>$internal_book->bid,'company_id'=>$company->id];
-                CompanySpecialBook::updateOrCreate($data);
-            }
-        }*/
-       /*for($i=0;$i<512;$i++){
-
-           $count = DB::connection('chapter_order_mysql')->select("SELECT co.uid FROM ".'chapter_orders'."$i as co WHERE co.created_at>='2018-11-15 00:00:00' AND EXISTS(SELECT 1 FROM user_pay WHERE user_pay.uid=co.uid)");
-           $chapter_order = DB::connection('chapter_order_mysql')
-               ->select("SELECT co2.uid as Uid,sum(co2.fee) AS Fee FROM ".'chapter_orders'.$i." AS co2 WHERE co2.uid IN(SELECT co.uid FROM ".'chapter_orders'."$i as co WHERE co.created_at>='2018-11-15 00:00:00' AND EXISTS(SELECT 1 FROM user_pay WHERE user_pay.uid=co.uid)) GROUP BY co2.uid");
-       }*/
-       /* $res = DB::select("SELECT yq_move_channels.distribution_channel_id AS distribution_channelId,bills.recharge_amount as rechargeAmount,settlement_price AS settlementPrice,bills.recharge_amount-bills.settlement_price AS diff,bills.id as bill_id FROM bills,yq_move_channels WHERE bills.rate=0.9 AND bills.distribution_channel_id = yq_move_channels.distribution_channel_id and bills.date >= date(yq_move_channels.created_at) and yq_move_channels.created_at <= '2018-11-05'");
-        foreach ($res as $item) {
-            //DB::table('financial_stats')->where('distribution_channel_id',$item->distribution_channelId)->update()
-            DB::select("UPDATE financial_stats SET financial_stats.enable_withdrawal_amount=financial_stats.enable_withdrawal_amount+".($item->diff)." WHERE financial_stats.distribution_channel_id=".$item->distribution_channelId);
-            DB::select("UPDATE bills SET bills.settlement_price=bills.recharge_amount,bills.rate=1 WHERE bills.id=".($item->bill_id));
-            \Log::info('changed:channel_id:'.($item->distribution_channelId).'diff:'.($item->diff).'bill_id:'.($item->bill_id));
-        }*/
-       \Log::info("user subscribe data task start-----time:".date('Y-m-d H:i:s'));
-       print_r("user subscribe data task start-----time:".date('Y-m-d H:i:s'));
-        $count =1;
-       DB::table('force_subscribe_users')
-           ->join('orders','orders.uid','=','force_subscribe_users.uid')
-           ->select(DB::raw('distinct force_subscribe_users.uid'))
-           ->where('orders.status','PAID')
-           ->where('orders.created_at','>=','2018-11-01')
-           ->whereBetween('subscribe_time',['2018-11-01','2018-11-25 23:59:59'])
-           ->orderBy('uid')
-           ->chunk(10000,function($res) use(&$count){
-               $data = [];
-               foreach ($res as $item){
-                   $books_order = DB::table('book_orders')
-                       ->where('uid',$item->uid)
-                       ->select(['uid','bid','created_at','fee as sum_fee','book_name'])
-                       ->whereBetween('created_at',['2018-11-01','2018-12-03 23:59:59'])
-                       ->get();
-                   $books_order = json_decode(json_encode($books_order),true);
-                   $chapter_orders = DB::connection('chapter_order_mysql')
-                       ->table('chapter_orders'.(($item->uid)%512))
-                       ->select(DB::raw('uid,bid,min(created_at) as created_at,book_name,sum(fee) as sum_fee'))
-                       ->groupBy('bid')
-                       ->where('uid',$item->uid)
-                       ->get();
-                   $chapter_orders = json_decode(json_encode($chapter_orders),true);
-                   $temps = array_merge($books_order,$chapter_orders);
-                   foreach ($temps as $temp){
-                       $data[]=array($temp['uid'],$temp['bid'],$temp['book_name'],$temp['sum_fee'],$temp['created_at']);
-                   }
-               }
-               $header = ['uid','bid','book_name','订阅书币','订阅时间'];
-               saveExcelData($header,$data,storage_path('app/subscribe_data'.$count.'.xlsx'));
-               print_r("done jobs count:".$count);
-               $count++;
-           });
-       print_r("user subscribe data task end-----time:".date('Y-m-d H:i:s'));
-       \Log::info("user subscribe data task end-----time:".date('Y-m-d H:i:s'));
-    }
-}

+ 0 - 129
app/Console/Commands/Temp/FansArpu.php

@@ -1,129 +0,0 @@
-<?php
-
-namespace App\Console\Commands\Temp;
-
-use Log;
-use Illuminate\Console\Command;
-use DB;
-
-class FansArpu extends Command
-{
-    /**
-     * 执行命令   php artisan temp:fans_arpu
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'temp:fans_arpu';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '90天-120天新关粉丝arpu';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        /**
-         * CREATE TABLE `fans_arpu` (
-        `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
-        `date` date DEFAULT NULL,
-        `distribution_channel_id` int(11) DEFAULT NULL,
-        `appid` varchar(255) DEFAULT NULL,
-        `distribution_channel_name` varchar(255) DEFAULT NULL,
-        `gzh_name` varchar(255) DEFAULT NULL,
-        `fans_num` int(11) DEFAULT NULL,
-        `recharge_amount_in_90_days` decimal(11,2) DEFAULT NULL,
-        `recharge_amount_in_91_days` decimal(11,2) DEFAULT NULL,
-        `recharge_amount_in_92_days` decimal(11,2) DEFAULT NULL,
-        `recharge_amount_in_93_days` decimal(11,2) DEFAULT NULL,
-        `recharge_amount_in_94_days` decimal(11,2) DEFAULT NULL,
-        `recharge_amount_in_95_days` decimal(11,2) DEFAULT NULL,
-        `recharge_amount_in_96_days` decimal(11,2) DEFAULT NULL,
-        `recharge_amount_in_97_days` decimal(11,2) DEFAULT NULL,
-        `created_at` datetime DEFAULT NULL,
-        `updated_at` datetime DEFAULT NULL,
-        PRIMARY KEY (`id`)
-        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-         *
-         * update fans_arpu,distribution_channels,official_accounts set fans_arpu.distribution_channel_id = distribution_channels.id,fans_arpu.distribution_channel_name=distribution_channels.nickname,fans_arpu.gzh_name = official_accounts.nickname  where fans_arpu.appid = official_accounts.appid and official_accounts.distribution_channel_id = distribution_channels.id
-         *
-         *
-         */
-        print_r("======90天-120天新关粉丝arpu 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        Log::info("======90天-120天新关粉丝arpu 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        $_start = new \DateTime('2017-12-12');
-        $_end = new \DateTime('2017-12-24');
-
-        foreach (new \DatePeriod($_start, new \DateInterval('P1D'), $_end) as $d)
-        {
-
-            $date = $d->format('Y-m-d');
-            $start = $date;
-            $end = date('Y-m-d', strtotime($date) + 86400);
-
-            $offset = 0;
-            $limit = 1000;
-            $data = [];
-            $_m_data = [];
-
-            while (true) {
-
-                print_r("select send_order_id,uid,appid,unsubscribe_time,distribution_channel_id,created_at from force_subscribe_users where created_at > '{$start}' and created_at < '{$end}' limit $offset,$limit" . date("y-m-d H:i:s" . "\n"));
-                $users = DB::select("select send_order_id,uid,appid,unsubscribe_time,distribution_channel_id,created_at from force_subscribe_users where created_at > '{$start}' and created_at < '{$end}' limit $offset,$limit");
-                print_r("users_count:".count($users));
-                if (count($users) == 0) break;
-
-                foreach ($users as $user) {
-                    @$data[$user->appid]['fans_num']++;
-
-                    $order = DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->first();
-                    if ($order)
-                    {
-                        @$data[$user->appid]['recharge_amount_in_90_days'] += (float)DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at)+86400*90))->sum('price');
-                        @$data[$user->appid]['recharge_amount_in_91_days'] += (float)DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at)+86400*91))->sum('price');
-                        @$data[$user->appid]['recharge_amount_in_92_days'] += (float)DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at)+86400*92))->sum('price');
-                        @$data[$user->appid]['recharge_amount_in_93_days'] += (float)DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at)+86400*93))->sum('price');
-                        @$data[$user->appid]['recharge_amount_in_94_days'] += (float)DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at)+86400*94))->sum('price');
-                        @$data[$user->appid]['recharge_amount_in_95_days'] += (float)DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at)+86400*95))->sum('price');
-                        @$data[$user->appid]['recharge_amount_in_96_days'] += (float)DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at)+86400*96))->sum('price');
-                        @$data[$user->appid]['recharge_amount_in_97_days'] += (float)DB::table('orders')->where('uid', $user->uid)->where('status', 'PAID')->where('created_at','<=',date('Y-m-d H:i:s',strtotime($user->created_at)+86400*97))->sum('price');
-                    }
-                }
-                $offset = $offset + $limit;
-            }
-
-            foreach ($data as $appid => $item) {
-                $_data = [];
-                $_data['date'] = $date;
-                $_data['appid'] = $appid;
-                $_data['fans_num'] = isset($item['fans_num']) ? $item['fans_num'] : 0;
-                $_data['recharge_amount_in_90_days'] = isset($item['recharge_amount_in_90_days']) ? $item['recharge_amount_in_90_days'] : 0;
-                $_data['recharge_amount_in_91_days'] = isset($item['recharge_amount_in_91_days']) ? $item['recharge_amount_in_91_days'] : 0;
-                $_data['recharge_amount_in_92_days'] = isset($item['recharge_amount_in_92_days']) ? $item['recharge_amount_in_92_days'] : 0;
-                $_data['recharge_amount_in_93_days'] = isset($item['recharge_amount_in_93_days']) ? $item['recharge_amount_in_93_days'] : 0;
-                $_data['recharge_amount_in_94_days'] = isset($item['recharge_amount_in_94_days']) ? $item['recharge_amount_in_94_days'] : 0;
-                $_data['recharge_amount_in_95_days'] = isset($item['recharge_amount_in_95_days']) ? $item['recharge_amount_in_95_days'] : 0;
-                $_data['recharge_amount_in_96_days'] = isset($item['recharge_amount_in_96_days']) ? $item['recharge_amount_in_96_days'] : 0;
-                $_data['recharge_amount_in_97_days'] = isset($item['recharge_amount_in_97_days']) ? $item['recharge_amount_in_97_days'] : 0;
-
-                $_data['created_at'] = $_data['updated_at'] = date('Y-m-d H:i:s');
-                $_m_data[] = $_data;
-            }
-            DB::table('fans_arpu')->insert($_m_data);
-
-            Log::info("======90天-120天新关粉丝arpu 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-            print_r("======90天-120天新关粉丝arpu 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-
-
-        }
-    }
-}

+ 0 - 61
app/Console/Commands/Temp/FixRealReg.php

@@ -1,61 +0,0 @@
-<?php
-
-namespace App\Console\Commands\Temp;
-
-use Log;
-use Illuminate\Console\Command;
-use DB;
-
-class FixRealReg extends Command
-{
-    /**
-     * 执行命令   php artisan temp:fix_read_reg
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'temp:fix_read_reg';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '修复实际注册用户数';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-
-        print_r("======修复实际注册用户数 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        Log::info("======修复实际注册用户数 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        $_start = new \DateTime('2017-12-12');
-        $_end = new \DateTime('2017-12-24');
-
-        foreach (new \DatePeriod($_start, new \DateInterval('P1D'), $_end) as $d)
-        {
-
-            $date = $d->format('Y-m-d');
-            $start = $date;
-            $end_time = date('Y-m-d', strtotime($date) + 86400);
-
-            $real_reg_data_res = DB::select("select distribution_channel_id,count(1) num from users u where created_at >='{$date}' and created_at <'{$end_time}'  and not exists (select id from users where openid = u.openid and created_at < '{$date}' limit 1) group by distribution_channel_id");
-dump($real_reg_data_res);
-            foreach ($real_reg_data_res as $item)
-            {
-                DB::table('order_day_stats')->where('date',$date)->where('distribution_channel_id',$item->distribution_channel_id)->update(['real_register_user_num'=>(int)$item->num]);
-            }
-
-            Log::info("======修复实际注册用户数 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-            print_r("======修复实际注册用户数 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-
-
-        }
-    }
-}

+ 0 - 148
app/Console/Commands/Temp/OfficialAccountSubStat.php

@@ -1,148 +0,0 @@
-<?php
-
-namespace App\Console\Commands\Temp;
-
-use Log;
-use Illuminate\Console\Command;
-use DB;
-
-class OfficialAccountSubStat extends Command
-{
-    /**
-     * 执行命令   php artisan temp:official_account_sub_stat
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'temp:official_account_sub_stat';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '服务号订阅数据';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        /**
-         * CREATE TABLE `official_account_day_sub_stats` (
-        `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
-        `appid` varchar(255) DEFAULT NULL,
-        `official_account_name` varchar(255) DEFAULT NULL,
-        `date` date DEFAULT NULL,
-        `reward_balance` int(11) DEFAULT NULL,
-        `charge_balance` int(11) DEFAULT NULL,
-        `fee` int(11) DEFAULT NULL,
-        PRIMARY KEY (`id`)
-        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;*
-         *
-         */
-        print_r("======服务号订阅数据 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        Log::info("======服务号订阅数据 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        $_start = new \DateTime('2017-12-12');
-        $_end = new \DateTime('2018-06-01');
-
-        foreach (new \DatePeriod($_start, new \DateInterval('P1D'), $_end) as $d)
-        {
-
-            $date = $d->format('Y-m-d');
-            $start = $date;
-            $end = date('Y-m-d', strtotime($date) + 86400);
-
-            $offset = 0;
-            $limit = 1000;
-            $data = [];
-
-
-            for ($i=0;$i<512;$i++)
-            {
-                //章节订购
-                $chapter_table = 'zsy_sub.chapter_orders'.$i;
-                $force_user_table = 'yueduyun.force_subscribe_users';
-                $users = DB::connection('chapter_order_mysql')->select("select appid,{$chapter_table}.distribution_channel_id,{$chapter_table}.uid,sum(fee) sum_fee,sum(charge_balance) sum_charge_balance,sum(reward_balance) sum_reward_balance from {$chapter_table} left join {$force_user_table} on {$chapter_table}.uid = {$force_user_table}.uid  where {$chapter_table}.created_at >= '{$date}' and {$chapter_table}.created_at < '{$end}'  group by {$chapter_table}.uid");
-                print_r("select appid,{$chapter_table}.distribution_channel_id,{$chapter_table}.uid,sum(fee) sum_fee,sum(charge_balance) sum_charge_balance,sum(reward_balance) sum_reward_balance from {$chapter_table} left join {$force_user_table} on {$chapter_table}.uid = {$force_user_table}.uid  where {$chapter_table}.created_at >= '{$date}' and {$chapter_table}.created_at < '{$end}'  group by {$chapter_table}.uid" . "\n");
-
-                foreach ($users as $user) {
-
-                    if(!$user->appid)
-                    {
-                        //获取第一个appid
-                        $official_account = DB::connection('chapter_order_mysql')->table('yueduyun.official_accounts')->where('distribution_channel_id',$user->distribution_channel_id)->first();
-                        if($official_account)
-                        {
-                            $user->appid = $official_account->appid;
-                        }else{
-                            $user->appid = 'no';
-                        }
-
-                    }
-                    if($user->appid)
-                    {
-                        @$data[$user->appid]['fee'] += $user->sum_fee;
-                        @$data[$user->appid]['charge_balance'] += $user->sum_charge_balance;
-                        @$data[$user->appid]['reward_balance'] += $user->sum_reward_balance;
-                    }
-
-                }
-            }
-
-
-            //按本订购
-            $chapter_table = 'yueduyun.book_orders';
-            $force_user_table = 'yueduyun.force_subscribe_users';
-            $users = DB::connection('chapter_order_mysql')->select("select appid,{$chapter_table}.distribution_channel_id,{$chapter_table}.uid,sum(fee) sum_fee,sum(charge_balance) sum_charge_balance,sum(reward_balance) sum_reward_balance from {$chapter_table} left join {$force_user_table} on {$chapter_table}.uid = {$force_user_table}.uid  where {$chapter_table}.created_at >= '{$date}' and {$chapter_table}.created_at < '{$end}'  group by {$chapter_table}.uid");
-            print_r("select appid,{$chapter_table}.distribution_channel_id,{$chapter_table}.uid,sum(fee) sum_fee,sum(charge_balance) sum_charge_balance,sum(reward_balance) sum_reward_balance from {$chapter_table} left join {$force_user_table} on {$chapter_table}.uid = {$force_user_table}.uid  where {$chapter_table}.created_at >= '{$date}' and {$chapter_table}.created_at < '{$end}'  group by {$chapter_table}.uid" . "\n");
-
-            foreach ($users as $user) {
-
-                if(!$user->appid)
-                {
-                    //获取第一个appid
-                    $official_account = DB::connection('chapter_order_mysql')->table('yueduyun.official_accounts')->where('distribution_channel_id',$user->distribution_channel_id)->first();
-                    if($official_account)
-                    {
-                        $user->appid = $official_account->appid;
-                    }else{
-                        $user->appid = 'no';
-                    }
-
-                }
-                if($user->appid)
-                {
-                    @$data[$user->appid]['fee'] += $user->sum_fee;
-                    @$data[$user->appid]['charge_balance'] += $user->sum_charge_balance;
-                    @$data[$user->appid]['reward_balance'] += $user->sum_reward_balance;
-                }
-
-            }
-
-            foreach ($data as $appid=>$_item)
-            {
-                $_data = [];
-                $_data['appid'] = $appid;
-                $_data['fee'] = $_item['fee'];
-                $_data['date'] = $date;
-                $_data['charge_balance'] = $_item['charge_balance'];
-                $_data['reward_balance'] = $_item['reward_balance'];
-                $official_account = DB::connection('chapter_order_mysql')->table('yueduyun.official_accounts')->where('appid',$appid)->first();
-                $_data['official_account_name'] = $official_account ? $official_account->nickname : '';
-                DB::connection('chapter_order_mysql')->table('yueduyun.official_account_day_sub_stats')->insert($_data);
-            }
-
-
-
-            Log::info("======服务号订阅数据 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-            print_r("======服务号订阅数据 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-
-
-        }
-    }
-}

+ 0 - 244
app/Console/Commands/Temp/PayUserAutoSub.php

@@ -1,244 +0,0 @@
-<?php
-
-namespace App\Console\Commands\Temp;
-
-use Log;
-use Illuminate\Console\Command;
-use DB;
-use GuzzleHttp\Client;
-use GuzzleHttp\Cookie\CookieJar;
-use Hashids;
-use Redis;
-
-class PayUserAutoSub extends Command
-{
-    /**
-     * 执行命令   php artisan temp:pay_user_auto_do
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'temp:pay_user_auto_do';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '自动订阅';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-
-        print_r("======自动订阅 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        Log::info("======自动订阅 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        $date = date('Y-m-d');
-        //$total_real_fee = 0;//总消耗
-        $host = DB::table('sys_configs')->where('name','brush_host')->pluck('value')->first();
-        if(!$host) dd('系统参数配置有误');
-
-        DB::table('temp_pay_users')->where('to_do_date',$date)->where('has_done',0)->orderBy('id','asc')->chunk(1000,function ($users) use($host){
-
-            foreach ($users as $user)
-            {
-                $brush_read_data = [];
-                $record_data = $user;
-dump('user:');dump($user);
-                $user_day_real_fee = 0;//用户日总消耗书币
-                $brush_read_time = strtotime($user->to_do_date) + mt_rand(8*3600,9*3600);//阅读时间
-
-                $read_record_info =  Redis::hgetall('book_read:' . $user->uid);
-
-                dump('read_record_fee');dump($read_record_info);
-
-                $last_record = isset($read_record_info['last_read']) ? explode('_',$read_record_info['last_read']) : null;
-
-                $latest_read_at = $last_record ? $last_record[2] : 0;
-
-                //判断最近一个月是否有阅读 有则continue 无阅读记录可能存储有误
-
-                dump('$latest_read_at');dump($latest_read_at);
-        //        if(!$latest_read_at || (time() - $latest_read_at < 30*86400)) continue;
-
-                //阅读记录
-                $to_do_bids = explode(',',$user->bids);//等待刷的bid
-
-                //用户信息
-                $user_info = DB::table('users')->find($user->uid);
-                dump('user');dump($user_info);
-
-                //已经订购的图书
-                $ordered_books = [];
-
-                $client = new Client();
-                $cookieJar = CookieJar::fromArray([
-                    'web_user_auth' => encrypt($user_info->id)
-                ], $host);
-dump('$to_do_bids');dump($to_do_bids);
-
-                //阅读图书
-                foreach ($to_do_bids as $_bid)
-                {
-                    $encode_bid = Hashids::encode($_bid);
-                    $latest_chapter_id = 0;
-
-                    //判断bid阅读按本付费或按章
-                    if(isset($read_record_info[$_bid]) && $read_record_info[$_bid] && $_dt = explode('_',$read_record_info[$_bid]))
-                    {
-                        //上次阅读章节位置
-                        $latest_chapter_id = $_dt[0];
-                    }
-                    $book_info = DB::table('book_configs')->where('bid',$_bid)->first();
-dump('$book_info');dump($book_info);
-                      //按本
-                    $is_pay_by_book = $book_info->charge_type == 'BOOK' ? true : false;
-                    if($is_pay_by_book)
-                    {
-                        $is_book_ordered = DB::table('book_orders')->where('uid',$user->uid)->where('bid',$_bid)->count();
-                        if(!$is_book_ordered) {
-                            if($user_day_real_fee >= $user->to_do_fee) break;//用户超过日上限则退出
-
-                            //直接订购最后一章
-                            $last_chapter = DB::table('chapters')->select('id')->where('bid', $_bid)->orderBy('sequence', 'desc')->first();
-                            $_cid = $last_chapter->id;
-                            $res = $client->request('GET', "http://{$host}/api/books/{$encode_bid}/balance/chapterOrders/{$_cid}",[
-                                'cookies' => $cookieJar,
-                                'delay'=>300,
-                                'query'=>['inter_not_need_sub'=>1]
-                            ]);
-                            dump('http code :');dump($res->getStatusCode());
-
-                            $res_data = json_decode($res->getBody()->getContents(), true);
-                            dump('$res_data');dump($res_data);
-
-                            $book_ordered = DB::table('book_orders')->where('uid', $user->uid)->where('bid', $_bid)->first();
-                            dump('$book_ordered');dump($book_ordered);
-
-                            if ($book_ordered)//订购成功
-                            {
-                                $brush_read_time += mt_rand(60,180);//增加阅读时间
-                                $brush_read_data['book'][] = ['bid'=>$_bid,'read_time'=>date('Y-m-d H:i:s',$brush_read_time)];
-
-                                $ordered_books[] = $_bid;
-                                $user_day_real_fee += $book_ordered->fee;//用户单日消耗
-                                $ordered_books[] = $_bid;
-                            }
-
-                        }else {
-                            $ordered_books[] = $_bid;
-                        }
-
-                    }else{
-                        //按章节
-                        //查用户起始章节
-                        $table = $user->uid%512;
-                        dump('$table');dump($table);
-                        $latest_sub_chapter = DB::connection('chapter_order_mysql')->table('chapter_orders'.$table)->where('uid',$user->uid)->where('bid',$_bid)->orderBy('id','desc')->first();
-                        dump('$latest_sub_chapter');dump($latest_sub_chapter);
-                        $start_cid = $latest_sub_chapter ? $latest_sub_chapter->cid : 0;
-
-                        //获取章节目录 cid
-                        $chapters = DB::table('chapters')->select(['id'])->where('bid',$_bid)->where('is_vip',1)->orderBy('sequence')->get();
-                        $chapter_count = count($chapters);
-                        $start = false;
-                        //dump('$chapters');dump($chapters);
-                        foreach ($chapters as $seq=>$_chapter)
-                        {
-                            if(!$start_cid) $start = true;
-                            $_cid = $_chapter->id;
-
-                            if($start)
-                            {
-                                //订阅
-
-                                //判断是否已经订购
-                                $is_ordered = DB::connection('chapter_order_mysql')->table('chapter_orders'.$table)->where('uid',$user->uid)->where('bid',$_bid)->where('cid',$_cid)->count();
-                                if(!$is_ordered)
-                                {
-                                    if($user_day_real_fee >= $user->to_do_fee) break;//用户超过日上限则退出
-dump("http://{$host}/api/books/{$encode_bid}/chapters/{$_cid}");
-
-                                    $res = $client->request('GET', "http://{$host}/api/books/{$encode_bid}/chapters/{$_cid}",[
-                                        'cookies' => $cookieJar,
-                                        'delay'=>300,
-                                        'query'=>['inter_not_need_sub'=>1]
-                                    ]);
-
-                                    dump('http code :');dump($res->getStatusCode());
-
-                                    $return_info = json_decode($res->getBody()->getContents(),true);
-                                    dump($return_info);
-                                    if(isset($return_info['code']) && $return_info['code'] == 0)
-                                    {
-
-                                        $chapter_order = DB::connection('chapter_order_mysql')->table('chapter_orders'.$table)->where('uid',$user->uid)->where('bid',$_bid)->where('cid',$_cid)->first();
-                                        if($chapter_order)//判断是否订购成功
-                                        {
-                                            $brush_read_time += mt_rand(60,125);//增加阅读时间
-                                            $brush_read_data['chapter'][] = ['bid'=>$_bid,'cid'=>$_cid,'read_time'=>date('Y-m-d H:i:s',$brush_read_time)];
-                                            $user_day_real_fee += $chapter_order->fee;//用户单日消耗
-                                            if($chapter_count-1 == $seq) $ordered_books[] = $_bid;
-                                        }
-                                    }elseif(isset($return_info['code']) && $return_info['code'] > 0){
-                                        break;
-                                    }
-                                }
-                            }
-
-                            if($start_cid && $_chapter->id == $start_cid)
-                            {
-                                $start = true;
-                            }
-                        }
-                    }
-
-                }
-
-                $real_do_fee = $user_day_real_fee;
-                $done_bids = implode(',',$ordered_books);
-                $has_done = 1;
-                $done_num = $user->done_num+1;
-                $done_time = date('Y-m-d H:i:s');
-
-                $up_data = compact('real_do_fee','done_bids','has_done','done_num','done_time');
-
-                //更新刷数据用户
-                DB::table('temp_pay_users')->where('id',$user->id)->update($up_data);
-
-                $record_data = array_merge((array)$record_data,$up_data);
-                unset($record_data['id']);
-                //插入到records
-                dump('record_data');dump($record_data);
-                DB::table('temp_pay_users_records')->insert($record_data);
-
-                //更新订阅时间
-                foreach ($brush_read_data as $type=>$_item)
-                {
-                    if($type=='book')
-                    {
-                        foreach ($_item as $_sub)
-                        {
-                            DB::table('book_orders')->where('uid',$user->uid)->where('bid',$_sub['bid'])->update(['created_at'=>$_sub['read_time'],'updated_at'=>$_sub['read_time']]);
-                        }
-                    }
-                    if($type=='chapter')
-                    {
-                        foreach ($_item as $_sub)
-                        {
-                            DB::connection('chapter_order_mysql')->table('chapter_orders'.$table)->where('uid',$user->uid)->where('bid',$_sub['bid'])->where('cid',$_sub['cid'])->update(['created_at'=>$_sub['read_time'],'updated_at'=>$_sub['read_time']]);
-                        }
-                    }
-                }
-            }
-        });
-
-        Log::info("======自动订阅 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-        print_r("======自动订阅 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-    }
-}

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 123
app/Console/Commands/Temp/SelectPayUser.php


+ 0 - 106
app/Console/Commands/Temp/SensitiveChapter.php

@@ -1,106 +0,0 @@
-<?php
-
-namespace App\Console\Commands\Temp;
-
-use Log;
-use Illuminate\Console\Command;
-use DB;
-
-class SensitiveChapter extends Command
-{
-    /**
-     * 执行命令   php artisan temp:sensitive_chapter
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'temp:sensitive_chapter';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '敏感章节查询';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-
-        print_r("======敏感章节查询 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        Log::info("======敏感章节查询 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        $bad_words = DB::table('bad_book_info')->pluck('badInfo')->all();
-dump($bad_words);
-        $bid_stas = [];
-        $start = 0;
-        $n = time();
-
-        for($i=1;$i<5000;$i++)
-        {
-            dump($i);
-            $end = 1000 * $i;
-            $chapters = DB::select("select * from chapters where id >={$start} and id <{$end}");
-            dump("select * from chapters where id >={$start} and id <{$end}");
-            $start = $end;
-
-            dump('start:' . date("Y-m-d H:i:s"));
-            if(!$chapters) break;//章节获取即退出
-
-            foreach ($chapters as $chapter) {
-                $one_chapter_has_words = [];
-                foreach ($bad_words as $bad_word)
-                {
-                    $bad_word = str_replace('/','\\',$bad_word);
-                    preg_match_all("/{$bad_word}/", $chapter->content, $matches);
-                    $current_count = count($matches[0]);
-                    if ($current_count) {
-                        $one_chapter_has_words[] = $bad_word;
-                    }
-                }
-
-                if($one_chapter_has_words)
-                {
-                    //图书敏感章节数+1
-                    $bid_stas[$chapter->bid] = @$bid_stas[$chapter->bid] + 1;
-                    //插入章节敏感信息
-                    $_chapter_data = [
-                        'bid'=>$chapter->bid,
-                        'cid'=>$chapter->id,
-                        'sequence'=>$chapter->sequence,
-                        'name'=>$chapter->name,
-                        'words'=>implode(',',$one_chapter_has_words),
-                        'time'=>$n,
-                        'created_at'=>date("Y-m-d H:i:s"),
-                        'updated_at'=>date("Y-m-d H:i:s")
-                    ];
-                    DB::table('sensitive_chapters')->insert($_chapter_data);
-                }
-            }
-            dump($bid_stas);
-            dump('end:' . date("Y-m-d H:i:s"));
-        }
-
-        foreach($bid_stas as $bid=>$num)
-        {
-            $book_config = DB::table('book_configs')->select('book_name')->where('bid',$bid)->first();
-            $_data = [
-                'bid'=>$bid,
-                'num'=>$num,
-                'time'=>$n,
-                'book_name'=>$book_config ? $book_config->book_name : '',
-                'created_at'=>date("Y-m-d H:i:s"),
-                'updated_at'=>date("Y-m-d H:i:s")
-            ];
-            DB::table('book_sensitive_stats')->insert($_data);
-        }
-
-        Log::info("======敏感章节查询 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-        print_r("======敏感章节查询 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-    }
-}

+ 0 - 92
app/Console/Commands/Temp/Siorder.php

@@ -1,92 +0,0 @@
-<?php
-
-namespace App\Console\Commands\Temp;
-
-use Log;
-use Illuminate\Console\Command;
-use DB;
-
-class Siorder extends Command
-{
-    /**
-     * 执行命令   php artisan temp:siorder
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'temp:siorder';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '书币消耗';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        /**
-         * CREATE TABLE `si_orders` (
-        `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
-        `uid` int(11) DEFAULT NULL,
-        `first_recharge_time` datetime DEFAULT NULL,
-        `sec_recharge_time` datetime DEFAULT NULL,
-        `price` decimal(11,2) DEFAULT NULL,
-        `site_id` int(11) DEFAULT NULL,
-        `sub_time` datetime DEFAULT NULL,
-        `balance` decimal(11,2) DEFAULT NULL,
-        `x` int(11) DEFAULT NULL,
-        `xx` int(11) DEFAULT NULL,
-        `xxx` int(11) DEFAULT NULL,
-        `xxxxxxx` int(11) DEFAULT NULL,
-        `site_name` varchar(255) DEFAULT NULL,
-        PRIMARY KEY (`id`)
-        ) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
-         *
-         * select distinct uid,created_at,price,distribution_channel_id from orders o where status ='PAID' and created_at > '2018-04-27' and created_at < '2018-05-02' and not exists(select id from orders where created_at < '2018-04-27' and status ='PAID' and uid = o.uid LIMIT 1)
-
-        update si_orders,orders set si_orders.sec_recharge_time = orders.created_at where si_orders.uid = orders.uid and orders.created_at > si_orders.first_recharge_time and status ='PAID'
-
-        update si_orders,force_subscribe_users set si_orders.sub_time = force_subscribe_users.created_at where si_orders.uid = force_subscribe_users.uid
-
-        update si_orders,users set si_orders.balance = users.balance where si_orders.uid = users.id
-         *
-         * update si_orders,distribution_channels set si_orders.site_name = distribution_channels.nickname where si_orders.site_id = distribution_channels.id
-
-         *
-         *
-         */
-        print_r("======书币消耗 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        Log::info("======书币消耗 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-
-        DB::table('si_orders')->orderBy('id','desc')->chunk(1000,function ($orders){
-
-            foreach ($orders as $order)
-            {
-                $uid = $order->uid;
-                $book_fee1 = (int)DB::table('book_orders')->where('uid',$uid)->where('created_at','>',$order->first_recharge_time)->where('created_at','<',date('Y-m-d H:i:s',strtotime($order->first_recharge_time)+86400))->sum('fee');
-                $book_fee2 = DB::table('book_orders')->where('uid',$uid)->where('created_at','>',$order->first_recharge_time)->where('created_at','<',date('Y-m-d H:i:s',strtotime($order->first_recharge_time)+86400*2))->sum('fee');
-                $book_fee3 = DB::table('book_orders')->where('uid',$uid)->where('created_at','>',$order->first_recharge_time)->where('created_at','<',date('Y-m-d H:i:s',strtotime($order->first_recharge_time)+86400*3))->sum('fee');
-                $book_fee7 = DB::table('book_orders')->where('uid',$uid)->where('created_at','>',$order->first_recharge_time)->where('created_at','<',date('Y-m-d H:i:s',strtotime($order->first_recharge_time)+86400*7))->sum('fee');
-                $table = 'chapter_orders'.$uid%512;
-                $x = $book_fee1 + (int)DB::connection('chapter_order_mysql')->table($table)->where('uid',$uid)->where('created_at','>',$order->first_recharge_time)->where('created_at','<',date('Y-m-d H:i:s',strtotime($order->first_recharge_time)+86400))->sum('fee');
-                $xx = $book_fee2 + (int)DB::connection('chapter_order_mysql')->table($table)->where('uid',$uid)->where('created_at','>',$order->first_recharge_time)->where('created_at','<',date('Y-m-d H:i:s',strtotime($order->first_recharge_time)+86400*2))->sum('fee');
-                $xxx = $book_fee3 + (int)DB::connection('chapter_order_mysql')->table($table)->where('uid',$uid)->where('created_at','>',$order->first_recharge_time)->where('created_at','<',date('Y-m-d H:i:s',strtotime($order->first_recharge_time)+86400*3))->sum('fee');
-                $xxxxxxx = $book_fee7 + (int)DB::connection('chapter_order_mysql')->table($table)->where('uid',$uid)->where('created_at','>',$order->first_recharge_time)->where('created_at','<',date('Y-m-d H:i:s',strtotime($order->first_recharge_time)+86400*7))->sum('fee');
-
-                DB::table('si_orders')->where('id',$order->id)->update(compact('x','xx','xxx','xxxxxxx'));
-            }
-
-        });
-
-        Log::info("======书币消耗 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-        print_r("======书币消耗 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-    }
-}

+ 0 - 92
app/Console/Commands/Temp/UserSign.php

@@ -1,92 +0,0 @@
-<?php
-
-namespace App\Console\Commands\Temp;
-
-use Log;
-use Illuminate\Console\Command;
-use DB;
-
-class UserSign extends Command
-{
-    /**
-     * 执行命令   php artisan tmep:user_sign
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'tmep:user_sign';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '书币大于500最近签到';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        /**
-         * CREATE TABLE `temp_user_sign` (
-        `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
-        `uid` int(11) DEFAULT NULL,
-        `distribution_channel_id` int(11) DEFAULT NULL,
-        `balance` decimal(11,2) DEFAULT NULL,
-        `latest_sign_time` datetime DEFAULT NULL,
-        PRIMARY KEY (`id`)
-        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-         *
-         *
-         */
-        print_r("======书币大于500最近签到生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        Log::info("======书币大于500最近签到生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        $_start = new \DateTime('2017-12-12');
-        $_end = new \DateTime('2018-02-18');
-
-        foreach (new \DatePeriod($_start, new \DateInterval('P1D'), $_end) as $d)
-        {
-
-            $date = $d->format('Y-m-d');
-            $start = $date;
-            $end = date('Y-m-d', strtotime($date) + 86400);
-
-            $offset = 0;
-            $limit = 1000;
-            $data = [];
-
-            while (true) {
-
-                print_r("select id,distribution_channel_id,balance from users where balance > 500 limit $offset,$limit" . "\n");
-                $users = DB::select("select id,distribution_channel_id,balance from users where balance > 500 limit $offset,$limit");
-                print_r("users_count:".count($users));
-                if (count($users) == 0) break;
-
-                foreach ($users as $user) {
-
-                    $sign = DB::table('user_sign')->where('uid',$user->id)->orderBy('id','desc')->first();
-                    $data[] = [
-                        'uid'=>$user->id,
-                        'distribution_channel_id'=>$user->distribution_channel_id,
-                        'balance'=>$user->balance,
-                        'latest_sign_time'=>$sign ? $sign->created_at : null
-                    ];
-                }
-
-                $offset = $offset + $limit;
-                DB::table('temp_user_sign')->insert($data);
-                $data = [];
-            }
-
-            Log::info("======书币大于500最近签到生成 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-            print_r("======书币大于500最近签到生成 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-
-
-        }
-    }
-}

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 339
app/Console/Commands/TemporaryTask.php


+ 0 - 61
app/Console/Commands/Tool/MaintainSubscribeReplyRedisData.php

@@ -1,61 +0,0 @@
-<?php
-/**
-维护关注维护的redis数据格式
- */
-
-namespace App\Console\Commands\Tool;
-
-use Log;
-use Illuminate\Console\Command;
-use App\Modules\OfficialAccount\Models\TempForceSubscribeUsers;
-use App\Modules\OfficialAccount\Services\MsgService;
-use App\Modules\Channel\Models\Channel;
-use DB;
-
-class MaintainSubscribeReplyRedisData extends Command
-{
-    /**
-     * 执行命令  MaintainSubscribeReplyRedisData
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'MaintainSubscribeReplyRedisData {channel_id}';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '维护关注维护的redis数据格式';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        ini_set('memory_limit', '1024M');
-        print_r('memory_used:'.memory_get_usage()."\n");
-        print_r("======维护关注维护的redis数据格式【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        $distribution_channel_id = $this->argument('channel_id');
-        if($distribution_channel_id != 'all'){
-        	\Log::info('start_one_initOriginReply:'.$distribution_channel_id);
-        	MsgService::initOriginReply($distribution_channel_id);
-        }else{
-        	$distribution_channels = Channel::getAllChannels();
-        	// 渠道列表
-        	foreach($distribution_channels as $distribution_channel){
-        		$distribution_channel_id = $distribution_channel->id;
-        		\Log::info('start_initOriginReply:'.$distribution_channel_id);
-        		MsgService::initOriginReply($distribution_channel_id);
-        	}
-        }
-       
-        
-        print_r("======维护关注维护的redis数据格式 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-        print_r('memory_used:'.memory_get_usage()."\n");
-    }
-}

+ 0 - 50
app/Console/Commands/Tool/MaintainTempForceSubscribeUser.php

@@ -1,50 +0,0 @@
-<?php
-/**
-维护公众号交互的用户表
- */
-
-namespace App\Console\Commands\Tool;
-
-use Log;
-use Illuminate\Console\Command;
-use App\Modules\OfficialAccount\Models\TempForceSubscribeUsers;
-use DB;
-
-class MaintainTempForceSubscribeUser extends Command
-{
-    /**
-     * 执行命令  MaintainTempForceSubscribeUser
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'MaintainTempForceSubscribeUser';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '维护公众号交互的用户表';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        ini_set('memory_limit', '1024M');
-        print_r('memory_used:'.memory_get_usage()."\n");
-        print_r("======维护公众号交互的用户表【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-      
-        $end_time = date('Y-m-d 00:00:00',strtotime('- 3 day'));
-        \Log::info('OfficialAccountUserTranser_start:end_time:'.$end_time);
-        TempForceSubscribeUsers::deleteTempForceSubscribeUsersByTime($end_time);
-        \Log::info('OfficialAccountUserTranser_end');
-        
-        print_r("======维护公众号交互的用户表 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-        print_r('memory_used:'.memory_get_usage()."\n");
-    }
-}

+ 0 - 87
app/Console/Commands/Tool/OfficialAccountUserTranser.php

@@ -1,87 +0,0 @@
-<?php
-/**
-公众号用户迁移
- */
-
-namespace App\Console\Commands\Tool;
-
-use Log;
-use Illuminate\Console\Command;
-use App\Modules\User\Services\UserService;
-use App\Modules\OfficialAccount\Services\ForceSubscribeService;
-use DB;
-
-class OfficialAccountUserTranser extends Command
-{
-    /**
-     * 执行命令   Tool:OfficialAccountUserTranser  {distribution_channel_id} {from_appid} {to_appid}
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'Tool:OfficialAccountUserTranser {distribution_channel_id} {from_appid} {to_appid}';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '公众号用户数据迁移';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        ini_set('memory_limit', '1024M');
-        print_r('memory_used:'.memory_get_usage()."\n");
-        print_r("======公众号用户数据迁移【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        
-        $distribution_channel_id = $this->argument('distribution_channel_id');
-        $from_appid = $loop = $this->argument('from_appid');
-        $to_appid = $this->argument('to_appid');
-        
-        \Log::info('OfficialAccountUserTranser_start:distribution_channel_id:'.$distribution_channel_id.' from_appid:'.$from_appid.' to_appid:'.$to_appid);
-        $next_openid = '';
-        $skip = $loop = 0;
-        while ( $loop <= 50) {
-        	$loop++;
-        	$users = array();
-        	// 全服务号粉丝发,要记录next_openid
-        	if($loop > 1 && empty($next_openid)){
-        		\Log::info('OfficialAccountUserTranse_break,loop:'.$loop.' skip:'.$skip);
-        		break;
-        	}
-        	$user_res = ForceSubscribeService::getFullOfficialAccountUsers($to_appid,$next_openid);
-        	$users = $user_res['openids'];
-        	$next_openid = $user_res['next_openid'];
-
-        	\Log::info('loop'.$loop.' user_num:'.count($users).' next_openid:'.$next_openid);
-        	//                         \Log::info($users);
-        	$skip += count($users);
-        	if(count($users)>0){
-        		for ($i=0; $i < count($users); $i++) {
-        			$openid = isset($users[$i]['openid'])?$users[$i]['openid']:'';
-        			$userinfo = ForceSubscribeService::getUserInfo($to_appid, $openid);
-        			$nickname = isset($userinfo['nickname'])?$userinfo['nickname']:'';
-        			\Log::info('openid:'.$openid.' nickname:'.$nickname);
-        			// 
-        			if(empty($nickname)) continue;
-        			$origin_user = UserService::getUserByNickAndChannelId($distribution_channel_id,$nickname);
-        			if(!empty($origin_user)){
-        				\Log::info('distribution_channel_id:'.$distribution_channel_id.' to_appid:'.$to_appid.' openid:'.$openid.' uid:'.$origin_user->id);
-        				ForceSubscribeService::updateSubscribeUserTransfer($distribution_channel_id,$origin_user->id,$from_appid,$to_appid,$openid);
-        			}
-        		}
-        	}
-        }
-       
-        \Log::info('OfficialAccountUserTranser_end loop:'.$loop.' $skip:'.$skip);
-        
-        print_r("======公众号用户数据迁移 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-        print_r('memory_used:'.memory_get_usage()."\n");
-    }
-}

+ 0 - 75
app/Console/Commands/Tool/TestSmartPush.php

@@ -1,75 +0,0 @@
-<?php
-/**
-测试类
- */
-
-namespace App\Console\Commands\Tool;
-
-use Log;
-use Illuminate\Console\Command;
-use App\Modules\User\Services\UserService;
-use App\Modules\User\Services\UserSignService;
-use App\Modules\Book\Services\BookConfigService;
-use App\Modules\OfficialAccount\Services\ForceSubscribeService;
-use App\Modules\OfficialAccount\Services\OfficialAccountService;
-use App\Modules\User\Services\ReadRecordService;
-use DB;
-
-class TestSmartPush extends Command
-{
-    /**
-     * 执行命令   Tool:TestSmartPush
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'Tool:TestSmartPush';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '智能推送测试';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        ini_set('memory_limit', '1024M');
-        print_r('memory_used:'.memory_get_usage()."\n");
-        print_r("======智能推送测试【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        $uid=6;
-//         $book_num=2;
-//         $bid=2;
-       
-// //         $recommend_books = BookConfigService::getSimpleChannelBookLoop($bid,$book_num,$uid);
-// //         \Log::info('$recommend_books');
-// //         \Log::info($recommend_books);
-        
-//         $distribution_channel_id = 14;
-//         $url = 'https://site2.yunqibook.com/reader?bid=2JWv0Xk1B3yqYRPxxWR6Gejno54PZrO9&cid=485877&fromsource=smart_push';
-        
-//         $result = OfficialAccountService::get_short_url($distribution_channel_id,$url);
-        
-//         $result = ReadRecordService::getFirstReadRecord($uid);
-//         for($i =109861725;$i<=109861735;$i++){
-//         	UserSignService::signToday($i);
-//         }
-        
-        // 注册动作-》回调订单
-        $action_type = 'CallBackOrder';
-        $param = [
-	        'order_sn' => '123',
-	        'openid' => '123',// 没有openid,用uid写log
-        ];
-        UserService::PushUserActionToQueue($action_type,14,$param);
-        
-        print_r("======智能推送测试 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-        print_r('memory_used:'.memory_get_usage()."\n");
-    }
-}

+ 0 - 164
app/Console/Commands/Tool/ThirdPlatomUserTranser.php

@@ -1,164 +0,0 @@
-<?php
-/**
-其他平台公众号用户迁移到我们平台
- */
-namespace App\Console\Commands\Tool;
-
-use App\Modules\OfficialAccount\Services\OfficialAccountService;
-use App\Modules\OfficialAccount\Models\OfficialAccount;
-use App\Modules\OfficialAccount\Models\ForceSubscribeUsers;
-use App\Modules\OfficialAccount\Models\TempForceSubscribeUsers;
-use Log;
-use Illuminate\Console\Command;
-use App\Modules\User\Services\UserService;
-use App\Modules\OfficialAccount\Services\ForceSubscribeService;
-use DB;
-
-class ThirdPlatomUserTranser extends Command
-{
-    /**
-     * 执行命令   Tool:ThirdPlatomUserTranser {appid}
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'Tool:ThirdPlatomUserTranser {--appid=} {--next_openid=}';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '其他平台公众号用户迁移到我们平台';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        ini_set('memory_limit', '1024M');
-        print_r('memory_used:'.memory_get_usage()."\n");
-        print_r("======其他平台公众号用户迁移到我们平台【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        
-        $appid = $this->option('appid');
-        $next_openid = $this->option('next_openid');
-        if(empty($appid) || empty($next_openid)){
-        	\Log::info('ThirdPlatomUserTranser_appid_is_null:'.$appid);
-        	exit();
-        }
-        
-        \Log::info('ThirdPlatomUserTranser_start:$appid:'.$appid.' $next_openid:'.$next_openid);
-        // 检查appid是否存在
-        $param_official_account = ['appid'=>$appid];
-        $official_account  = OfficialAccountService::officialAccountByAppid($param_official_account);
-        
-        $distribution_channel_id = isset($official_account->distribution_channel_id)?$official_account->distribution_channel_id:'';
-        
-        if(empty($official_account) || empty($distribution_channel_id)){
-        	\Log::info('ThirdPlatomUserTranser_official_account_is_null:'.$appid.' $distribution_channel_id:'.$distribution_channel_id);
-        	exit();
-        }
-        \Log::info('ThirdPlatomUserTranser_exist:'.$appid.' official_account:'.json_encode($official_account));
-        
-        if($next_openid == '-1'){
-        	$next_openid = '';
-        }
-        $skip = $loop = 0;
-        
-        while ( $loop <= 100) {
-        	$loop++;
-        	$users = array();
-        	// 全服务号粉丝发,要记录next_openid
-        	if($loop > 1 && empty($next_openid)){
-        		\Log::info('OfficialAccountUserTranse_break,loop:'.$loop.' skip:'.$skip);
-        		break;
-        	}
-        	$user_res = ForceSubscribeService::getFullOfficialAccountUsers($appid,$next_openid);
-        	$users = $user_res['openids'];
-        	$next_openid = $user_res['next_openid'];
-
-        	\Log::info('loop'.$loop.' user_num:'.count($users).' next_openid:'.$next_openid);
-        	//                         \Log::info($users);
-        	$skip += count($users);
-        	if(count($users)>0){
-        		for ($i=0; $i < count($users); $i++) {
-        			\Log::info('loop:'.$loop.' i:'.$i);
-        			try{
-        				$openid = isset($users[$i]['openid'])?$users[$i]['openid']:'';
-        				$unionid = $openid;
-        				$userinfo = ForceSubscribeService::getUserInfoAll($appid, $openid);
-        				$nickname = isset($userinfo['nickname'])?$userinfo['nickname']:'';
-        				$province = isset($userinfo['province'])?$userinfo['province']:'';
-        				$city = isset($userinfo['city'])?$userinfo['city']:'';
-        				$country = isset($userinfo['country'])?$userinfo['country']:'';
-        				$headimgurl = isset($userinfo['headimgurl'])?$userinfo['headimgurl']:'';
-        				$sex = isset($userinfo['sex'])?$userinfo['sex']:'0';
-        				\Log::info('openid:'.$openid.' nickname:'.$nickname);
-        				// 先用openid 判断强关表是否存在
-        				$forceSubscribeUsers = ForceSubscribeUsers::forceSubscribeUsersByOpenidAndAC($openid,$appid,$distribution_channel_id);
-        				if(!empty($forceSubscribeUsers)){
-        					\Log::info('user_exist:'.$openid);
-        					continue;
-        				}
-        				 
-        				// user表
-        				$user = [
-	        				'openid'=>$openid,
-	        				'unionid'=>$unionid,
-	        				'nickname'=>$nickname,
-	        				'distribution_channel_id'=>$distribution_channel_id,
-	        				'province'=>$province,
-	        				'city'=>$city,
-	        				'country'=>$country,
-	        				'headimgurl'=>$headimgurl,
-	        				'sex'=>$sex,
-        				];
-        				// 实际是根据union_id和distribution_channel_id做更新
-        				$added_user = UserService::addUser($user);
-        				$uid = $added_user->id;
-        				\Log::info('add_user_id:'.$uid);
-        				if(!empty($uid)){
-        					// force_subsribe_users
-        					$add_forceSubscribeUsers = [
-	        					'uid'=>$uid,
-	        					'openid'=>$openid,
-	        					'appid'=>$appid,
-	        					'is_subscribed'=>1,
-	        					'subscribe_time'=>date('Y-m-d H:i:s'),
-	        					'distribution_channel_id'=>$distribution_channel_id,
-	        					'last_interactive_time'=>date('Y-m-d H:i:s'),
-        					];
-        					\Log::info('create_force_subscribe_user:'.$openid);
-        					ForceSubscribeUsers::firstOrCreate($add_forceSubscribeUsers);
-        					 
-        					// temp_force_subsribe_users
-        					$add_tempForceSubscribeUsers = [
-	        					'uid'=>$uid,
-	        					'openid'=>$openid,
-	        					'appid'=>$appid,
-	        					'is_subscribed'=>1,
-	        					'subscribe_time'=>date('Y-m-d H:i:s'),
-	        					'distribution_channel_id'=>$distribution_channel_id,
-	        					'last_interactive_time'=>date('Y-m-d H:i:s'),
-        					];
-        					\Log::info('create_temp_force_subscribe_user:'.$openid);
-        					TempForceSubscribeUsers::firstOrCreate($add_tempForceSubscribeUsers);
-        				}
-        				 
-        			}catch(\Exception $e){
-        				\Log::info('auto_subscribe_ept:'.$e->getMessage());
-        			}
-        			
-        		}
-        	}
-        }
-       
-        \Log::info('ThirdPlatomUserTranser_end loop:'.$loop.' $skip:'.$skip);
-        
-        print_r("======其他平台公众号用户迁移到我们平台 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-        print_r('memory_used:'.memory_get_usage()."\n");
-    }
-}

+ 0 - 87
app/Console/Commands/Tool/TitleImageStatistics.php

@@ -1,87 +0,0 @@
-<?php
-/**
-维护公众号交互的用户表
- */
-
-namespace App\Console\Commands\Tool;
-
-use Log;
-use Illuminate\Console\Command;
-use App\Modules\Promotion\Services\PromotionService;
-use App\Modules\Promotion\Models\TempTitleImageStatistic;
-use DB;
-use Redis;
-
-class TitleImageStatistics extends Command
-{
-    /**
-     * 执行命令  TitleImageStatistics
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'TitleImageStatistics';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '标题图片统计';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        ini_set('memory_limit', '1024M');
-        print_r('memory_used:'.memory_get_usage()."\n");
-        print_r("======标题图片统计【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        $headlines = PromotionService::getFullHeadline();
-        $images = PromotionService::getFullMessageRandomDocumentCovers(3);
-        $calculate_time = date('Y-m-d H:i:s');
-        foreach($headlines as $key=>$headline){
-        	\Log::info('headlines_key:'.$key);
-        	foreach($images as $image){
-        		try{
-        			$title_image_key = $headline['id'].'_'.$image['id'];
-        			//         		\Log::info('TitleImageStatistics_title_image_key:'.$title_image_key);
-        			$title_image_statistics_key = 'smart_push_from_title_image:'.$title_image_key;
-        			$send_num = Redis::hget($title_image_statistics_key,'send_num');
-        			
-        			if($send_num > 0){
-        				\Log::info('TitleImageStatistics_insert_title_image_key:'.$title_image_key);
-        				$title_image_send_uv_key = 'smart_push_from_title_image_send_uv:'.$title_image_key;
-        				$title_image_click_uv_key = 'smart_push_from_title_image_click_uv:'.$title_image_key;
-        				$send_uv = Redis::SCARD($title_image_send_uv_key);
-        				$click_uv = Redis::SCARD($title_image_click_uv_key);
-        				$click_num = Redis::hget($title_image_statistics_key,'click_num');
-        			
-        				$insert_data = [
-	        				'title_id'=>$headline['id'],
-	        				'image_id'=>$image['id'],
-	        				'send_uv'=>isset($send_uv)?$send_uv:0,
-	        				'click_uv'=>isset($click_uv)?$click_uv:0,
-	        				'send_num'=>isset($send_num)?$send_num:0,
-	        				'click_num'=>isset($click_num)?$click_num:0,
-	        				'calculate_time'=>$calculate_time,
-        				];
-        				\Log::info($insert_data);
-        				 
-        				TempTitleImageStatistic::create($insert_data);
-        			}
-        		}catch(\Exception $e){
-        			\Log::info('TitleImageStatistics_ept:'.$e->getMessage());
-        		}
-        	
-        	}
-        }
-        
-        
-        print_r("======标题图片统计 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-        print_r('memory_used:'.memory_get_usage()."\n");
-    }
-}

+ 0 - 85
app/Console/Commands/Trade/GenerateOrderDayStat.php

@@ -1,85 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: songdb
- * Date: 2017/12/26
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands\Trade;
-
-use App\Modules\Trade\Services\OrderDayStatService;
-use App\Modules\Channel\Services\ChannelService;
-use Log;
-use Illuminate\Console\Command;
-use DB;
-
-class GenerateOrderDayStat extends Command
-{
-    /**
-     * 执行命令   php artisan generate_order_day_stat
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'generate_order_day_stat';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '渠道订单日统计数据生成';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        print_r("======渠道订单日统计数据生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        Log::info("======渠道订单日统计数据生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        $channels = ChannelService::getAllChannels();
-
-        $date = date('Y-m-d',strtotime('-1 day'));
-        $end_time = date('Y-m-d H:i:s',strtotime($date) + 86400-1);
-        if(count($channels))
-        {
-            $min_uid = DB::table('users')->where('created_at','>=',$date)->min('id');
-            $max_uid = DB::table('users')->where('created_at','>=',$date)->where('created_at','<=',$end_time)->max('id');
-            $once_num = 5000;
-            $offset = 0;
-            //实际注册用户数
-            $start_uid = $min_uid;
-            $real_reg_data = [];
-            while (true)
-            {
-                $offset += $once_num;
-                $end_user = DB::table('users')->select('id')->where('created_at','>=',$date)->where('created_at','<=',$end_time)->skip($offset)->limit(1)->first();
-                $end_uid = $end_user ? $end_user->id : $max_uid;
-                $reg_data = DB::select("select distribution_channel_id,count(1) num from users u where id >= {$start_uid} and id <= {$end_uid} and not exists (select id from users where openid = u.openid and id < {$start_uid} limit 1) group by distribution_channel_id");
-
-                foreach ($reg_data as $_reg_data)
-                {
-                    @$real_reg_data[$_reg_data->distribution_channel_id] += (int)$_reg_data->num;
-                }
-                if($end_uid == $max_uid) break;
-
-                $start_uid = $end_uid;
-            }
-
-            $channels->each(function($channel) use($date,$real_reg_data){
-                $begin_time = strtotime($date)+86400;
-                $real_reg_num = isset($real_reg_data[$channel->id]) ? $real_reg_data[$channel->id] : 0;
-                if(strtotime($channel->created_at) <= $begin_time) OrderDayStatService::add($channel->id,$channel->channel_user_id, $date,$channel->nickname,$real_reg_num);
-            });
-        }
-
-        Log::info("======渠道订单日统计数据生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-        print_r("======渠道订单日统计数据生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-    }
-}

+ 0 - 58
app/Console/Commands/Trade/GenerateOrderStat.php

@@ -1,58 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: songdb
- * Date: 2017/12/26
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands\Trade;
-
-use App\Modules\Trade\Services\OrderStatService;
-use App\Modules\Channel\Services\ChannelService;
-use Log;
-use Illuminate\Console\Command;
-
-class GenerateOrderStat extends Command
-{
-    /**
-     * 执行命令   php artisan generate_order_stat
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'generate_order_stat';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '渠道订单统计数据生成';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        print_r("======渠道订单统计数据生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        Log::info("======渠道订单统计数据生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        $channels = ChannelService::getAllChannels();
-
-        $date = date('Y-m-d',strtotime('-1 day'));
-        if(count($channels))
-        {
-            $channels->each(function($channel) use($date){
-                OrderStatService::add($channel->id, $date);
-            });
-        }
-
-        Log::info("======渠道订单统计数据生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-        print_r("======渠道订单统计数据生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
-    }
-}

+ 0 - 46
app/Console/Commands/UnPaidUserActivity.php

@@ -1,46 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use App\Modules\OfficialAccount\Services\CustomMsgService;
-class UnPaidUserActivity extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'UnPaidUserActivity';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '未支付新用户充值活动';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $this->unPaidUserActivity();
-    }
-
-    public function unPaidUserActivity(){
-        CustomMsgService::unPaidUserActivity();
-    }
-}

+ 0 - 64
app/Console/Commands/UpdateBookClickCount.php

@@ -1,64 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use Redis;
-use App\Modules\Book\Models\BookConfig;
-use DB;
-use Log;
-class UpdateBookClickCount extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'book:clicknumupdate';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = 'Command description';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $this->update();
-    }
-
-    public function update(){
-
-        $field = date('Y-m-d',time()-86400);
-        $redis_key = 'book_click_num_bid_%s';
-        BookConfig::select('bid')->get()->map(function ($item, $key)use ($redis_key,$field){
-            $redis_bid_key = sprintf($redis_key,$item->bid);
-            $num = Redis::hget($redis_bid_key,$field);
-            if(!$num)$num = 0;
-            try{
-                DB::table('books_click_rates')->insert(['bid'=>$item->bid,'count'=>$num,'day'=>$field,'created_at'=>date('Y-m-d H:i:s'),'updated_at'=>date('Y-m-d H:i:s')]);
-                Redis::hdel($redis_bid_key,$field);
-            }catch (\Exception $e){
-
-            }
-
-
-        });
-    }
-}

+ 0 - 209
app/Console/Commands/UserPayUpdateTask.php

@@ -1,209 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/20
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands;
-
-use DB;
-use Illuminate\Console\Command;
-use Log;
-use Redis;
-
-
-class UserPayUpdateTask extends Command
-{
-    /**
-     * 执行命令   php artisan force_user_active
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'userPayUpdateTask';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '更新user_pay表字段';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $min_id = DB::table('global_configs')->where('config','pay_user_orders_max_id')->first();
-        $min_id = $min_id->config_value;
-        $max_id = DB::table('orders')->max('id');
-        //插入user_pay
-        while ($min_id+9999 <= $max_id){
-            DB::update("insert into user_pay (uid,distribution_channel_id,first_recharge_time,first_recharge_amount) 
-                select uid,distribution_channel_id,min(created_at),price from orders
-                 where status ='PAID'  and orders.id >=".$min_id." and orders.id<=".($min_id+9999)." and not EXISTS
-                 (select 1 from user_pay where uid = orders.uid) GROUP BY uid");
-            $min_id = $min_id+9999;
-        }
-        DB::table('global_configs')->where('config','pay_user_orders_max_id')->update(['config_value'=>$max_id]);
-
-        DB::update("update user_pay set user_pay.sec_recharge_time = (SELECT orders.created_at FROM orders
-where user_pay.uid = orders.uid and orders.created_at > user_pay.first_recharge_time and status = 'PAID' LIMIT 1),user_pay.sec_recharge_amount=(SELECT orders.price FROM orders
-where user_pay.uid = orders.uid and orders.created_at > user_pay.first_recharge_time and status = 'PAID' LIMIT 1) WHERE user_pay.sec_recharge_time is null");
-       //三充时间、金额更新
-        DB::update("update user_pay set user_pay.third_recharge_time = (SELECT orders.created_at FROM orders where user_pay.uid = orders.uid and orders.created_at > user_pay.sec_recharge_time AND status = 'PAID' LIMIT 1),
-user_pay.third_recharge_amount=(SELECT orders.price FROM orders where user_pay.uid = orders.uid and orders.created_at > user_pay.sec_recharge_time AND status='PAID' LIMIT 1) WHERE user_pay.third_recharge_amount is null");
-        //余额更新
-        DB::update("update user_pay set user_pay.balance = (select users.balance from users where users.id = user_pay.uid)");
-    }
-
-
-    private function test1()
-    {
-        $array = ['recent_read','subscribe','text_sign','text_search','readerover','readrecord','daily_sign'];//
-
-//        $array = ['daily_sign'];
-
-        foreach ($array as $v){
-            $users = Redis::SMEMBERS("temp_from_where:".$v);
-            foreach ($users as $user){
-                $sub = DB::connection('chapter_order_mysql')
-                    ->table('chapter_orders'.($user%512))
-                    ->where('uid',$user)
-                    ->whereBetween('created_at',['2018-11-23','2018-12-07 23:59:59'])
-                    ->first();
-                if($sub){
-                    $fee = DB::connection('chapter_order_mysql')
-                        ->table($v.'_user')
-                        ->select('uid','fee')
-                        ->where('uid',$user)
-                        ->first();
-                    DB::connection('chapter_order_mysql')
-                        ->table($v.'_user_sub')
-                        ->insert(['uid'=>$user,'fee'=>isset($fee->fee)?$fee->fee:-1]);
-                }
-            }
-             /*DB::connection('chapter_order_mysql')
-                 ->table($v.'_user_sub')
-                 ->select('uid','fee')
-                 ->orderBy('id')
-                 ->chunk(10000,function($users) use($v){
-                     foreach ($users as $user){
-                         $sub = DB::table('chapter_orders'.(($user->uid)%512))
-                             ->where('uid',$user->uid)
-                             ->whereBetween('created_at',['2018-11-23','2018-12-07 23:59:59'])
-                             ->first();
-                         if($sub){
-                             DB::table($v.'_user_sub')->insert(['uid'=>$user->uid,'fee'=>$user->fee]);
-                         }
-                     }
-            });*/
-
-            //$total_users = $above_five_thousands_total = $above_five_thousands_male = $above_five_thousands_felman = 0;
-            //$above_three_thousands_total = $above_three_thousands_male = $above_three_thousands_felman = 0;
-            //$users = Redis::SMEMBERS("temp_from_where:".$v);
-            /*foreach ($users as $user) {
-
-                DB::connection('chapter_order_mysql')->table($v.'_user')->insert(['uid'=>$user]);
-                /*$book_order = DB::table('book_orders')
-                    ->where('uid', $user)
-                    ->where('created_at', '>=', date('Y-m-d 00:00:00', strtotime('-15 day')))
-                    ->first();
-                $table_seq = ($user) % 512;
-                $chapter_order = DB::connection('chapter_order_mysql')
-                    ->table('chapter_orders' . $table_seq)
-                    ->where('uid', $user)
-                    ->where('created_at', '>=', date('Y-m-d 00:00:00', strtotime('-15 day')))
-                    ->first();
-
-                if ($book_order || $chapter_order) {
-                    //\Log::info(($user->uid).':'.$subscribe_fee);
-                    $total_users++;
-                    $chapter_order_sum = DB::connection('chapter_order_mysql')
-                        ->table('chapter_orders' . $table_seq)
-                        ->where('uid', $user)
-                        ->sum('fee');
-                    $book_order_sum = DB::table('book_orders')
-                        ->where('uid', $user)
-                        ->sum('fee');
-                    $subscribe_fee = $book_order_sum + $chapter_order_sum;
-                    $gender = 0;
-                    if ($subscribe_fee >= 3000) {
-                        $user_channel = DB::table('force_subscribe_users')
-                            ->leftjoin('books', 'books.id', '=', 'force_subscribe_users.bid')
-                            ->leftjoin('book_categories', 'book_categories.id', '=', 'books.category_id')
-                            ->where('force_subscribe_users.uid', $user)
-                            ->first();
-                        if ($user_channel) {
-                            $gender = $user_channel->pid;
-                        } else {
-                            \Log::error('user_gender_not_found:uid:' . $user);
-                        }
-                        $above_three_thousands_total++;
-                        if ($gender == 1) {
-                            $above_three_thousands_male++;
-                        }
-                        if ($gender == 2) {
-                            $above_five_thousands_felman++;
-                        }
-                    }
-
-                    if ($subscribe_fee >= 5000) {
-                        $user_channel = DB::table('force_subscribe_users')
-                            ->leftjoin('books', 'books.id', '=', 'force_subscribe_users.bid')
-                            ->leftjoin('book_categories', 'book_categories.id', '=', 'books.category_id')
-                            ->where('force_subscribe_users.uid', $user)
-                            ->first();
-                        if ($user_channel) {
-                            $gender = $user_channel->pid;
-                        } else {
-                            \Log::error('user_gender_not_found:uid:' . $user);
-                        }
-                        $above_three_thousands_total++;
-                        if ($gender == 1) {
-                            $above_three_thousands_male++;
-                        }
-                        if ($gender == 2) {
-                            $above_five_thousands_felman++;
-                        }
-                    }
-
-
-                //}
-            }*/
-            //return true;
-            /*myLog('temp_from_where')->info($v.'---------------------------------------------------');
-            myLog('temp_from_where')->info(compact(
-                'v',
-                'total_users',
-                'above_five_thousands_total',
-                'above_five_thousands_male',
-                'above_five_thousands_felman',
-                'above_three_thousands_total',
-                'above_three_thousands_male',
-                'above_three_thousands_felman'
-            ));*/
-        }
-
-    }
-
-    private function test2() {
-        $users = DB::table('daily_sign_user_sub')->where('fee',-1)->get();
-        foreach ($users as $user){
-            $fee = DB::table('chapter_orders'.($user%512))
-                ->where('uid',$user->uid)
-                ->where('created_at','<=','2018-12-07 23:59:59')
-                ->sum('fee');
-            $user->fee = $fee;
-            $user->save();
-        }
-
-    }
-}
-
-

+ 0 - 52
app/Console/Commands/UserSubscribleStatistic.php

@@ -1,52 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/20
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands;
-
-use App\Modules\User\Services\UserSubscribeBehaviorStatsService;
-use Log;
-use Illuminate\Console\Command;
-use DB;
-
-
-class UserSubscribleStatistic extends Command
-{
-    /**
-     * 执行命令   php artisan force_user_active
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'user_subscribe_statistic';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '强关用户行为统计';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-
-        print_r("======每日强关用户行为生成2 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-        Log::info("======每日强关用户行为生成2 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
-
-        UserSubscribeBehaviorStatsService::generateData();
-
-        Log::info("======每日强关用户行为生成2 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-        print_r("======每日强关用户行为生成2 【任务执行结束】=====" . date("y-m-d H:i:s" . "\n"));
-
-    }
-}

+ 0 - 697
app/Console/Commands/WapVisitStat.php

@@ -1,697 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use Redis;
-use DB;
-use App\Modules\User\Services\ReadRecordService;
-
-class WapVisitStat extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'wvs {type} {--extra=}';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = 'redis total';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $options = $this->option('extra');
-        $param = $this->argument('type');
-        if(empty($param)){
-            echo 'wvs {type:1,2,3,4,5...} {--extra}'.PHP_EOL;
-            return false;
-        }
-        if(!is_numeric($param)){
-            return false;
-        }
-
-        if($options && !is_numeric($options)){
-            return false;
-        }
-        switch ($param){
-            case 1:
-                $this->sendorderstats();
-                break;
-            case 2:
-                $this->sendOrderStatsEveryDay();
-                break;
-            case 3:
-                $this->allstats();
-                break;
-            case 4:
-                $this->allStatsEveryDay();
-                break;
-            case 5:
-                $this->activitystats();
-                break;
-            case 6:
-                $this->activityStatsEveryDay($options);
-                break;
-            case 7:
-                $this->beforeForceSubAndBeforeVipStats();
-                break;
-            case 8:
-                $this->beforeForceSubAndBeforeVipStatsEveryDay();
-                break;
-            case 9:
-                $this->start();
-                break;
-            case 10:
-                $this->subscribeKeyDel();
-                break;
-            case 11:
-                $this->substituteStats();
-                break;
-            case 12:
-                $this->StylePushStats();
-                break;
-        }
-        return false;
-    }
-
-    public function start()
-    {
-        $this->allStatsEveryDay();
-        $this->sendOrderStatsEveryDay();
-        $this->nowActivitys();
-        $this->beforeForceSubAndBeforeVipStatsEveryDay();
-        $this->browserSendOrderStatsEveryDay();
-        $this->substituteStats();
-    }
-
-    private function sendorderstats()
-    {
-        $day = date('Y-m-d',time()-86400);
-        // Redis::hincrby('send_order_uv_'.$param,$key,1);
-        //Redis::hincrby('send_order_pv_'.$param,$key,1);//每天
-        DB::table('send_orders')->select('id')->orderBy('id')->where('created_at', '<', date('Y-m-d H:i:s'))->chunk(1000, function ($res) use ($day){
-            $now = date('Y-m-d H:i:s');
-            foreach ($res as $v) {
-                $temp = Redis::hgetall('send_order_pv_' . $v->id);
-                if ($temp) {
-                    $data = [];
-                    foreach ($temp as $d => $u) {
-                        if ($d == 'total') {
-                            continue;
-                        }
-
-                        if($d == date('Y-m-d')){
-                            continue;
-                        }
-                        //$temp_uv = (int)Redis::hget('send_order_uv_' . $v->id, $d);
-                        //$data[] = ['day' => $d, 'key' => $v->id, 'from_type' => 'send_orders', 'pv' => $u, 'uv' => $temp_uv, 'type' => 3, 'created_at' => $now, 'updated_at' => $now];
-                        Redis::hdel('send_order_pv_' . $v->id,$d);
-
-                        Redis::hdel('send_order_uv_' . $v->id,$d);
-                    }
-                    //DB::table('wap_visit_stats')->insert($data);
-
-                    if(!Redis::hget('send_order_pv_' . $v->id,date('Y-m-d'))){
-                        Redis::del('send_order_pv_' . $v->id);
-                    }
-
-                    if(!Redis::hget('send_order_uv_' . $v->id,date('Y-m-d'))){
-                        Redis::del('send_order_uv_' . $v->id);
-                    }
-                }
-            }
-        });
-    }
-
-    private function sendOrderStatsEveryDay()
-    {
-        $day = date('Y-m-d', time() - 86400);
-        $now = date('Y-m-d H:i:s');
-        $key_like = 'send_order_pv_';
-        //$keys = Redis::keys($key_like . '*');
-        $data = [];
-        $i = 0;
-        $all_send_order_id = Redis::SMEMBERS('send_order'.$day);
-        foreach ($all_send_order_id as $send_order_id) {
-
-            $key = $key_like.$send_order_id;
-            $temp = Redis::hget($key, $day);
-            $temp_uv = (int)Redis::hget('send_order_uv_' . $send_order_id, $day);
-            $data[] = ['day' => $day, 'key' => $send_order_id, 'from_type' => 'send_orders', 'pv' => $temp, 'uv' => $temp_uv, 'type' => 3, 'created_at' => $now, 'updated_at' => $now];
-            if ($i && $i % 100 == 0) {
-                DB::table('wap_visit_stats')->insert($data);
-                $data = [];
-            }
-            $i++;
-            Redis::hdel($key,$day);
-            if(!Redis::hget($key,date('Y-m-d'))){
-                Redis::del($key);
-            }
-            Redis::hdel('send_order_uv_' . $send_order_id,$day);
-            if(!Redis::hget('send_order_uv_' . $send_order_id,date('Y-m-d'))){
-                Redis::del('send_order_uv_' . $send_order_id);
-            }
-        }
-        if($data){
-            DB::table('wap_visit_stats')->insert($data);
-        }
-        Redis::del('send_order'.$day);
-    }
-
-
-    private function browserSendOrderStatsEveryDay()
-    {
-        $day = date('Y-m-d', time() - 86400);
-        $now = date('Y-m-d H:i:s');
-        $key_like = 'browser_send_order_pv_';
-        //$keys = Redis::keys($key_like . '*');
-        $data = [];
-        $i = 0;
-        $all_send_order_id = Redis::SMEMBERS('browser_send_order'.$day);
-        foreach ($all_send_order_id as $send_order_id) {
-
-            $key = $key_like.$send_order_id;
-            $temp = Redis::hget($key, $day);
-            $temp_uv = (int)Redis::hget('browser_send_order_uv_' . $send_order_id, $day);
-            $data[] = ['day' => $day, 'key' => $send_order_id, 'from_type' => 'browser_send_orders', 'pv' => $temp, 'uv' => $temp_uv, 'type' => 3, 'created_at' => $now, 'updated_at' => $now];
-            if ($i && $i % 100 == 0) {
-                DB::table('wap_visit_stats')->insert($data);
-                $data = [];
-            }
-            $i++;
-            Redis::hdel($key,$day);
-            if(!Redis::hget($key,date('Y-m-d'))){
-                Redis::del($key);
-            }
-            Redis::hdel('browser_send_order_uv_' . $send_order_id,$day);
-            if(!Redis::hget('browser_send_order_uv_' . $send_order_id,date('Y-m-d'))){
-                Redis::del('browser_send_order_uv_' . $send_order_id);
-            }
-        }
-        if($data){
-            DB::table('wap_visit_stats')->insert($data);
-        }
-        Redis::del('browser_send_order'.$day);
-    }
-
-    private function allstats()
-    {
-        //Redis::sadd('push:distribution_channel_id:' . $distribution_channel_id . 'from:' . $from . ':date:' . date('Y-m-d'), $uid_cookie);
-        //Redis::hincrby('customer:push:click:distribution_channel_id:' . $distribution_channel_id . 'from:' . $from, date('Y-m-d'), 1);
-        $day = date('Y-m-d');
-        $now = date('Y-m-d H:i:s');
-        $all_channel_id = DB::table('distribution_channels')->select('id')->orderBy('id')->where('created_at', '<', $now)->get();
-        //$all_channel_id = [14];
-        foreach ($all_channel_id as $v) {
-            if($v->id == 2){
-                continue;
-            }
-            $like_pv_key = 'customer:push:click:distribution_channel_id:' . $v->id . 'from:';
-            $froms = $this->getFrom($v->id);
-            foreach ($froms as $from) {
-                $true_key = $like_pv_key.$from;
-                //echo '$true_key: '.$true_key.PHP_EOL;
-                $temp = Redis::hgetall($true_key);
-                $data = [];
-                $i = 0;
-                foreach ($temp as $d => $u) {
-                    if($d == $day){
-                        continue;
-                    }
-                    $uv_key = 'push:distribution_channel_id:' . $v->id . 'from:' . $from . ':date:' . $d;
-                    $temp_uv = (int)Redis::scard($uv_key);
-                    $data[] = ['day' => $d, 'key' => $v->id, 'from_type' => $from, 'pv' => $u, 'uv' => $temp_uv, 'type' => 1, 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')];
-                    Redis::del($uv_key);
-                    Redis::hdel($true_key,$d);
-                    if($i && $i%100 == 0){
-                        DB::table('wap_visit_stats')->insert($data);
-                        $data = [];
-                    }
-                    $i++;
-                }
-                $temp = Redis::hget($true_key,date('Y-m-d'));
-                if(!$temp){
-                    Redis::del($true_key);
-                }
-                DB::table('wap_visit_stats')->insert($data);
-            }
-        }
-    }
-
-    private function allStatsEveryDay()
-    {
-        //Redis::sadd('push:distribution_channel_id:' . $distribution_channel_id . 'from:' . $from . ':date:' . date('Y-m-d'), $uid_cookie);
-        //Redis::hincrby('customer:push:click:distribution_channel_id:' . $distribution_channel_id . 'from:' . $from, date('Y-m-d'), 1);
-        $day = date('Y-m-d', time() - 86400);
-        $now = date('Y-m-d H:i:s');
-        //$all_channel_id = DB::table('distribution_channels')->select('id')->orderBy('id')->where('created_at', '<', $now)->get();
-        $alls = Redis::SMEMBERS('wap_from_stats'.$day);
-        $i = 0;
-        $data = [];
-        foreach ($alls as $v){
-            $arr = explode('-',$v);
-            $distribution_channel_id = $arr[0];
-            $from = $arr[1];
-            if(count($arr) == 3){
-                $from = $arr[1].$arr[2];
-            }
-
-            $pv_key = 'customer:push:click:distribution_channel_id:' . $distribution_channel_id . 'from:' . $from;
-            $pv = (int)Redis::hget($pv_key, $day);
-            $uv_key = 'push:distribution_channel_id:' . $distribution_channel_id . 'from:' . $from . ':date:' . $day;
-            //echo '$pv_key: '.$pv_key.',$uv_key: $uv_key'.$uv_key.PHP_EOL;
-
-            $temp_uv = (int)Redis::scard($uv_key);
-            //echo $pv.'--'.$temp_uv.PHP_EOL;
-            $data[] = ['day' => $day, 'key' => $distribution_channel_id, 'from_type' => $from, 'pv' => $pv, 'uv' => $temp_uv, 'type' => 1, 'created_at' => $now, 'updated_at' => $now];
-            if($i && $i%100 == 0){
-                DB::table('wap_visit_stats')->insert($data);
-                $data = [];
-            }
-            $i++;
-            Redis::del($uv_key);
-            Redis::hdel($pv_key, $day);
-            //$temp = Redis::hget($pv_key,date('Y-m-d'));
-            $temp = Redis::hget($pv_key,date('Y-m-d'));
-            if(!$temp){
-                Redis::del($pv_key);
-            }
-        }
-        Redis::del('wap_from_stats'.$day);
-        if($data){
-            DB::table('wap_visit_stats')->insert($data);
-        }
-    }
-
-    private function activitystats()
-    {
-        $day = date('Y-m-d');
-        $now = date('Y-m-d H:i:s');
-        $uv_key_format = 'activity:%s:distribution_channel_id:%s:date:%s:uv';
-        $pv_key_format = 'activity:%s:distribution_channel_id:%s:pv';
-        $all_channel_id = DB::table('distribution_channels')->select('id')->orderBy('id')->where('created_at', '<', $now)->get();
-
-        foreach ($all_channel_id as $v) {
-            for ($i = 1; $i <= 140; $i++) {
-                $pv_key = sprintf($pv_key_format, $i, $v->id);
-                $pv_temp = Redis::hgetall($pv_key);
-                if ($pv_temp) {
-                    $data = [];
-                    foreach ($pv_temp as $d => $u) {
-                        if($d == $day){
-                            continue;
-                        }
-                        $uv_key = sprintf($uv_key_format, $i, $v->id, $d);
-                        //$temp_uv = (int)Redis::scard($uv_key);
-                        //$data[] = ['day' => $d, 'key' => $v->id, 'from_type' => $i, 'pv' => $u, 'uv' => $temp_uv, 'type' => 2, 'created_at' => $now, 'updated_at' => $now];
-                        Redis::del($uv_key);
-                    }
-                    //DB::table('wap_visit_stats')->insert($data);
-                }
-                Redis::del($pv_key);
-            }
-        }
-    }
-
-    private function activityStatsEveryDay($activity_id)
-    {
-        $day = date('Y-m-d',time()-86400);
-        $now = date('Y-m-d H:i:s');
-        $uv_key_format = 'activity:%s:distribution_channel_id:%s:date:%s:uv';
-        $pv_key_format = 'activity:%s:distribution_channel_id:%s:pv';
-        $all_channel_id = DB::table('distribution_channels')->select('id')->orderBy('id')->where('created_at', '<', $now)->get();
-
-        foreach ($all_channel_id as $v) {
-            $i = $activity_id;
-            $pv_key = sprintf($pv_key_format, $i, $v->id);
-            $pv_temp = Redis::hgetall($pv_key);
-            if ($pv_temp) {
-                $data = [];
-                foreach ($pv_temp as $d => $u) {
-                    if($d != $day){
-                        continue;
-                    }
-                    $uv_key = sprintf($uv_key_format, $i, $v->id, $d);
-                    $temp_uv = (int)Redis::scard($uv_key);
-                    $data[] = ['day' => $d, 'key' => $v->id, 'from_type' => $i, 'pv' => $u, 'uv' => $temp_uv, 'type' => 2, 'created_at' => $now, 'updated_at' => $now];
-                    Redis::del($uv_key);
-                    Redis::hdel($pv_key,$d);
-                }
-                DB::table('wap_visit_stats')->insert($data);
-
-                if( !Redis::hget($pv_key,date('Y-m-d'))){
-                    Redis::del($pv_key);
-                }
-            }
-        }
-    }
-
-    private function nowActivitys(){
-        $day = date('Y-m-d',time()-86400);
-        $activty_ids = DB::table('activity')->where('start_time','<=',$day.' 23:00:00')->where('end_time','>=',$day)->select('id')->get();
-        foreach ($activty_ids as $v){
-            //echo $v->id.PHP_EOL;
-            $this->activityStatsEveryDay($v->id);
-        }
-    }
-    private function beforeForceSubAndBeforeVipStats()
-    {
-        //$uv_key = 'book:'.$book->bid.':beforevip:uv:date:'.$date.':send_order_id:'.$send_order_id;
-        //$pv_key = 'book:'.$book->bid.':beforevip:pv:send_order_id:'.$send_order_id;
-        $send_order_ids = DB::table('send_orders')->where('send_time','>=','2017-12-10')->select('id')->get();
-        $now = date('Y-m-d H:i:s');
-        for ($i = 1; $i < 100; $i++) {
-            $like_key = 'book:' . $i . ':beforevip:pv:send_order_id:';
-            //$all_key = Redis::keys($like_key . '*');
-            if ($send_order_ids) {
-                foreach ($send_order_ids as $ids) {
-                    $data = [];
-                    $send_order_id = $ids->id;
-                    $kkk = $like_key.$send_order_id;
-                    $temp_pv = Redis::hgetall($kkk);
-                    foreach ($temp_pv as $d => $u) {
-                        if($d == 'total'){
-                            continue;
-                        }
-                        if($d == date('Y-m-d')){
-                            continue;
-                        }
-                        $uv_key = 'book:' . $i . ':beforevip:uv:date:' . $d . ':send_order_id:' . $send_order_id;
-                        //$temp_uv = (int)Redis::scard($uv_key);
-                        //$data[] = ['day' => $d, 'key' => $i, 'from_type' => $send_order_id, 'pv' => $u, 'uv' => $temp_uv, 'type' => 4, 'created_at' => $now, 'updated_at' => $now];
-                        Redis::del($uv_key);
-                        Redis::hdel($kkk,$d);
-                    }
-                    if(!Redis::hget($kkk,date('Y-m-d'))){
-                        Redis::del($kkk);
-                    }
-                    //DB::table('wap_visit_stats')->insert($data);
-                }
-            }
-        }
-        //$uv_key = 'book:' . $book->bid . ':beforeforcesub:uv:date:' . $date . ':send_order_id:' . $send_order_id;
-        //$pv_key = 'book:' . $book->bid . ':beforeforcesub::pvsend_order_id:' . $send_order_id;
-        for ($i = 1; $i < 100; $i++){
-            $like_key = 'book:' . $i . ':beforeforcesub::pvsend_order_id:';
-            //$send_order_ids = DB::table('send_orders')->where('send_time','>=','2017-12-10')->select('id')->get();
-            //$all_key = Redis::keys($like_key . '*');
-            if($send_order_ids){
-                foreach ($send_order_ids as $vvvv){
-                    $send_order_id = $vvvv->id;
-                    $ks = $like_key.$send_order_id;
-                    $data = [];
-                    $t_pv = Redis::hgetall($ks);
-                    foreach ($t_pv as $day => $v){
-                        if($day == 'total'){
-                            continue;
-                        }
-                        if($day == date('Y-m-d')){
-                            continue;
-                        }
-                        $uv_key = 'book:' . $i . ':beforeforcesub:uv:date:' . $day . ':send_order_id:' . $send_order_id;
-                        //$t_uv = (int)Redis::scard($uv_key);
-                        //$data[] = ['day' => $day, 'key' => $i, 'from_type' => $send_order_id, 'pv' => $v, 'uv' => $t_uv, 'type' => 5, 'created_at' => $now, 'updated_at' => $now];
-                        Redis::del($uv_key);
-                        Redis::hdel($ks,$day);
-                    }
-                    if(!Redis::hget($ks,date('Y-m-d'))){
-                        Redis::del($ks);
-                    }
-                    //DB::table('wap_visit_stats')->insert($data);
-                }
-            }
-        }
-    }
-
-    private function beforeForceSubAndBeforeVipStatsEveryDay()
-    {
-        //$uv_key = 'book:'.$book->bid.':beforevip:uv:date:'.$date.':send_order_id:'.$send_order_id;
-        //$pv_key = 'book:'.$book->bid.':beforevip:pv:send_order_id:'.$send_order_id;
-        $now = date('Y-m-d H:i:s');
-        $day = date('Y-m-d',time()-86400);
-        //Redis::SISMEMBER('beforevip'.$date,$book->bid.'-'.$send_order_id);
-        $alls = Redis::SMEMBERS('beforevip'.$day);
-        $j = 0;
-        $data = [];
-        foreach ($alls as $v){
-            $temp = explode('-',$v);
-            $i = $temp[0];
-            $send_order_id = $temp[1];
-            $like_key = 'book:' . $i . ':beforevip:pv:send_order_id:';
-            $kkk = $like_key.$send_order_id;
-            $temp_pv = Redis::hget($kkk,$day);
-            $uv_key = 'book:' . $i . ':beforevip:uv:date:' . $day . ':send_order_id:' . $send_order_id;
-            $temp_uv = (int)Redis::scard($uv_key);
-            $data[] = ['day' => $day, 'key' => $i, 'from_type' => $send_order_id, 'pv' => $temp_pv, 'uv' => $temp_uv, 'type' => 4, 'created_at' => $now, 'updated_at' => $now];
-            Redis::del($uv_key);
-            Redis::hdel($kkk,$day);
-            if($j && $j%100 == 0){
-                DB::table('wap_visit_stats')->insert($data);
-                $data = [];
-            }
-            if(!Redis::hget($kkk,date('Y-m-d'))){
-                Redis::del($kkk);
-            }
-            $j++;
-        }
-        if($data){
-            DB::table('wap_visit_stats')->insert($data);
-        }
-        Redis::del('beforevip'.$day);
-        $data = [];
-        // Redis::sadd('beforeforcesub'.$date,$book->bid.'-'.$send_order_id);
-        $alls = Redis::SMEMBERS('beforeforcesub'.$day);
-        if($alls){
-            $i = 0;
-            foreach ($alls as $vs){
-                $temp = explode('-',$vs);
-                $bid = $temp[0];
-                $send_order_id = $temp[1];
-                $like_key = 'book:' . $bid . ':beforeforcesub::pvsend_order_id:';
-                $kkk = $like_key.$send_order_id;
-                $temp_pv = Redis::hget($kkk,$day);
-                $uv_key = 'book:' . $bid . ':beforeforcesub:uv:date:' . $day . ':send_order_id:' . $send_order_id;
-                $temp_uv = (int)Redis::scard($uv_key);
-                $data[] = ['day' => $day, 'key' => $bid, 'from_type' => $send_order_id, 'pv' => $temp_pv, 'uv' => $temp_uv, 'type' => 5, 'created_at' => $now, 'updated_at' => $now];
-                Redis::del($uv_key);
-                Redis::hdel($kkk,$day);
-                if($i && $i%100 == 0){
-                    DB::table('wap_visit_stats')->insert($data);
-                    $data = [];
-                }
-                if(!Redis::hget($kkk,date('Y-m-d'))){
-                    Redis::del($kkk);
-                }
-                $i++;
-            }
-            if($data){
-                DB::table('wap_visit_stats')->insert($data);
-            }
-        }
-        Redis::del('beforeforcesub'.$day);
-    }
-
-    private function getFrom(int $channel_id):array {
-        $from = ['point_push','not_pay','hot_push','unpaid_send_activity','pay_daily_push',
-            'auto_custom_trusteeship','subscribe_push','sign_push','reader','signcallback','reader-year','recovery_push'];
-        $custom_ids = DB::table('custom_send_msgs')->select('id','trusteeship')->where('distribution_channel_id',$channel_id)->get();
-        if($custom_ids){
-            foreach ($custom_ids as $item){
-                if($item->trusteeship){
-                    for ($i=1;$i<=4;$i++){
-                        $from[] = 'custom_'.$item->id.'_'.$i;
-                    }
-                    $from[] = 'custom_'.$item->id;
-                }else{
-                    $from[] = 'custom_'.$item->id;
-                }
-            }
-        }
-
-        $template = DB::table('wechat_template_msgs')->select('id')->where('distribution_channel_id',$channel_id)->get();
-        if($template)  {
-            foreach ($template as $val){
-                $from[] = 'template_'.$val->id;
-            }
-        }
-
-        $keyword = DB::table('wechat_keyword_msgs')->select('id')->where('distribution_channel_id',$channel_id)->get();
-        if($keyword){
-            foreach ($keyword as $value){
-                $from[] = 'keyword_'.$value->id;
-            }
-        }
-        return $from;
-    }
-
-    private function subscribeKeyDel(){
-        $account = $this->officialAccount();
-        $key_format = 'www.zhuishuyun.comforce_subscribe:scene:%s:%s';
-        //print_r($account);return;
-        /*for ($i=1;$i<10000;$i++){
-            foreach ($account as $appid){
-                Redis::del(sprintf($key_format,$i,$appid));
-            }
-        }*/
-        for ($i = 10;$i<100;$i++){
-            $skip = $i*10000;
-            $res = DB::table('users')->select('id','distribution_channel_id')->orderBy('id')->where('id','>=',$skip)->limit(10000)->get();
-            foreach ($res as $v){
-                if(isset($account[$v->distribution_channel_id]) &&  $account[$v->distribution_channel_id]){
-                    foreach ($account[$v->distribution_channel_id] as $appid){
-                        Redis::del(sprintf($key_format,$i,$appid));
-                    }
-                }
-            }
-            $res = null;
-        }
-    }
-
-    private function officialAccount():array{
-        $res = DB::table('official_accounts')->select('distribution_channel_id','appid')->get();
-        $data = [];
-        foreach ($res as $v){
-            $data[$v->distribution_channel_id][] = $v->appid;
-            //$data[] = $v->appid;
-        }
-        return $data;
-    }
-
-    private function substituteStats(){
-
-        $day = date('Y-m-d',time()-86400);
-        //代充值按钮
-        $substituteButtonUvPv = Redis::SMEMBERS('substitutebuttonpvuv'.$day);
-        if($substituteButtonUvPv){
-            $i = 0;
-            $data = [];
-            foreach ($substituteButtonUvPv as $channel_id){
-                $temp_pv = Redis::hget('substitutebuttonpvuv:distribution_channel_id:' . $channel_id,$day);
-                $temp_uv_key = sprintf('substitutebuttonpvuv:distribution_channel_id:%s:date:%s',$channel_id,$day);
-                $temp_uv = Redis::scard($temp_uv_key);
-                $data[] = [
-                    'day' => $day,
-                    'key' => $channel_id,
-                    'from_type' => 'substitutebuttonpvuv',
-                    'pv' => $temp_pv,
-                    'uv' => $temp_uv,
-                    'type' => 6,
-                    'created_at' => date('Y-m-d H:i:s'),
-                    'updated_at' => date('Y-m-d H:i:s')
-                ];
-                if($i && $i%100 == 0){
-                    DB::table('wap_visit_stats')->insert($data);
-                    $data = [];
-                }
-                $i++;
-                Redis::del($temp_uv_key);
-                Redis::hdel('substitutebuttonpvuv:distribution_channel_id:' . $channel_id,$day);
-                $temp = Redis::hget('substitutebuttonpvuv:distribution_channel_id:' . $channel_id,date('Y-m-d'));
-                if(!$temp){
-                    Redis::del('substitutebuttonpvuv:distribution_channel_id:' . $channel_id);
-                }
-            }
-
-            if($data){
-                DB::table('wap_visit_stats')->insert($data);
-            }
-        }
-        Redis::del('substitutebuttonpvuv'.$day);
-
-        //代充值页面
-        $substituteButtonUvPv = Redis::SMEMBERS('substitutepagepvuv'.$day);
-        if($substituteButtonUvPv){
-            $i = 0;
-            $data = [];
-            foreach ($substituteButtonUvPv as $channel_id){
-                $temp_pv = Redis::hget('substitutepagepvuv:distribution_channel_id:' . $channel_id,$day);
-                $temp_uv_key = sprintf('substitutepagepvuv:distribution_channel_id:%s:date:%s',$channel_id,$day);
-                $temp_uv = Redis::scard($temp_uv_key);
-                $data[] = [
-                    'day' => $day,
-                    'key' => $channel_id,
-                    'from_type' => 'substitutepagepvuv',
-                    'pv' => $temp_pv,
-                    'uv' => $temp_uv,
-                    'type' => 7,
-                    'created_at' => date('Y-m-d H:i:s'),
-                    'updated_at' => date('Y-m-d H:i:s')
-                ];
-                if($i && $i%100 == 0){
-                    DB::table('wap_visit_stats')->insert($data);
-                    $data = [];
-                }
-                $i++;
-                Redis::del($temp_uv_key);
-                Redis::hdel('substitutepagepvuv:distribution_channel_id:' . $channel_id,$day);
-                $temp = Redis::hget('substitutepagepvuv:distribution_channel_id:' . $channel_id,date('Y-m-d'));
-                if(!$temp){
-                    Redis::del('substitutepagepvuv:distribution_channel_id:' . $channel_id);
-                }
-            }
-
-            if($data){
-                DB::table('wap_visit_stats')->insert($data);
-            }
-        }
-        Redis::del('substitutepagepvuv'.$day);
-    }
-
-    private function StylePushStats(){
-        $date = date('Y-m-d',time()-86400);
-        $record = Redis::SMEMBERS(sprintf('push:stylepush:date:%s',$date));
-        if(!$record)return ;
-        $i = 0;
-        $data = [];
-        foreach ($record as $item){
-            $item_array = explode('_',$item);
-            $distribution_channel_id = $item_array[0];
-            $gxhp = $item_array[1];
-            $uv_key = sprintf('push:stylepush:uv:%s:gxhp:%s:date:%s',$distribution_channel_id,$gxhp,$date);
-            $pv_key = sprintf('push:stylepush:pv:%s:gxhp:%s:date:%s',$distribution_channel_id,$gxhp,$date);
-            $uv = Redis::scard($uv_key);
-            $pv = Redis::get($pv_key);
-            $data[] = [
-                'day' => $date,
-                'key' => $distribution_channel_id,
-                'from_type' => $gxhp,
-                'pv' => $pv,
-                'uv' => $uv,
-                'type' => 8,
-                'created_at' => date('Y-m-d H:i:s'),
-                'updated_at' => date('Y-m-d H:i:s')
-            ];
-            Redis::del($uv_key);
-            Redis::del($pv_key);
-            if($i && $i%100 == 0){
-                DB::table('wap_visit_stats')->insert($data);
-                $data = [];
-            }
-            $i++;
-        }
-        if($data){
-            DB::table('wap_visit_stats')->insert($data);
-        }
-        Redis::del(sprintf('push:stylepush:date:%s',$date));
-    }
-}

+ 0 - 327
app/Console/Commands/WechatCustumerPushStatistical.php

@@ -1,327 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use App\Modules\OfficialAccount\Services\CustomMsgService;
-use App\Modules\Statistic\Services\WapVisitStatService;
-use Illuminate\Console\Command;
-use App\Modules\Subscribe\Models\Order;
-use Redis;
-use DB;
-use App\Modules\OfficialAccount\Models\CustomSendDayStats;
-use App\Modules\OfficialAccount\Models\CustomSendStats;
-use Log;
-
-class WechatCustumerPushStatistical extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'pay:wcps {--auto} {--all}';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '微信推送数据统计任务';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $all = $this->option('all');
-        if($all){
-            $this->autoAll();
-        }
-        $auto = $this->option('auto');
-        if($auto){
-            $this->updateAutoCustomStats(date('Y-m-d',time()-1*86400));
-            $this->updateAutoCustomStats(date('Y-m-d',time()-2*86400));
-            $this->updateAutoCustomStats(date('Y-m-d',time()-3*86400));
-            $this->totalStats();
-        }
-        if(!$all && !$auto){
-            $this->dayStat();
-        }
-    }
-
-    public function dayStat()
-    {
-        //Redis::sadd('push:activity:distribution_channel_id:'.$this->distribution_channel_id.'from:'.$from.':date:'.date('Y-m-d'),$this->uid);
-        //Redis::hincrby('customer:push:click:activity:distribution_channel_id:'.$this->distribution_channel_id.'from:'.$from,date('Y-m-d'),1);
-
-        //Redis::sadd('push:distribution_channel_id:'.$distribution_channel_id.'from:'.$from,date('Y-m-d'),decrypt($uid_cookie));
-        //Redis::hincrby('customer:push:click:distribution_channel_id:'.$distribution_channel_id.'from:'.$from,date('Y-m-d'),1);
-        $day = date('Y-m-d', time() - 86400);
-        $channel = $this->getChannel();
-        if (!$channel) return false;
-        foreach ($channel as $key => $value) {
-            if ($value->from == 'recovery_push') {
-                $click_num = Redis::scard('push:activity:distribution_channel_id:' . $value->distribution_channel_id . 'from:recovery_push:date:' . $day);
-            } else {
-                $click_num = Redis::scard('push:distribution_channel_id:' . $value->distribution_channel_id . 'from:' . $value->from . ':date:' . $day);
-            }
-            $order = Order::where('distribution_channel_id', $value->distribution_channel_id)
-                ->where('from_type', $value->from)
-                ->where('status', 'PAID')
-                ->select(DB::raw('count(*) as count'), DB::raw('sum(price) as money'))
-                ->whereBetween('created_at', [$day, date('Y-m-d')])
-                ->first();
-            if ($value->push_user_num <= 0) {
-                $success_pay_rate = 0;
-                $click_rate = 0;
-            } else {
-                $success_pay_rate = round($order->count / $value->push_user_num, 4) * 100;
-                $click_rate = round($click_num / $value->push_user_num, 4) * 100;
-            }
-
-            CustomSendDayStats::where('id', $value->id)->update([
-                'click_num' => $click_num,
-                'amount' => $order->money,
-                'success_pay_num' => $order->count,
-                'success_pay_rate' => $success_pay_rate,
-                'click_rate' => $click_rate
-            ]);
-
-            $res = CustomSendStats::where('distribution_channel_id', $value->distribution_channel_id)->where('from', $value->from)->first();
-            if ($res) {
-                $all_user = $res->push_user_num + $value->push_user_num;
-                if ($all_user == 0) {
-                    $success_pay_rate = 0;
-                    $click_rate = 0;
-                } else {
-                    $success_pay_rate = round(($res->success_pay_num + $order->count) / $all_user, 4) * 100;
-                    $click_rate = round(($res->click_num + $click_num) / $all_user, 4) * 100;
-                }
-                $res->push_user_num = $all_user;
-                $res->click_num = $res->click_num + $click_num;
-                $res->amount = $res->amount + $order->money;
-                $res->success_pay_num = $res->success_pay_num + $order->count;
-                $res->click_rate = $click_rate;
-                $res->success_pay_rate = $success_pay_rate;
-                $res->save();
-            } else {
-                CustomSendStats::create([
-                    'distribution_channel_id' => $value->distribution_channel_id,
-                    'push_user_num' => $value->push_user_num,
-                    'click_num' => $click_num,
-                    'amount' => $order->money,
-                    'success_pay_num' => $order->count,
-                    'success_pay_rate' => $success_pay_rate,
-                    'from' => $value->from,
-                    'click_rate' => $click_rate
-                ]);
-
-            }
-
-        }
-
-    }
-
-    public function getChannel()
-    {
-        $day = date('Y-m-d', time() - 86400);
-        $channel = CustomSendDayStats::select('id', 'distribution_channel_id', 'from', 'push_user_num')->where('date', $day)->get();
-        return $channel;
-    }
-
-    private function autoAll(){
-        $start = '2018-04-27';
-        $end = date('Y-m-d',time()-86400);
-        while (strtotime($start) <= strtotime($end)){
-            $this->updateAutoCustomStats($start);
-            $start = date('Y-m-d',strtotime($start)+86400);
-        }
-        $this->totalStats(true);
-    }
-    private function updateAutoCustomStats($day)
-    {
-        $data = $this->autoCustomTrusteeship($day);
-        if (empty($data))
-            return false;
-        foreach ($data as $info) {
-            $res = null;
-            $res = CustomSendStats::where('from', 'auto_custom_trusteeship')
-                ->where('distribution_channel_id', $info['distribution_channel_id'])
-                ->first();
-            if (!$res) {
-                CustomSendStats::create([
-                    'distribution_channel_id' => $info['distribution_channel_id'],
-                    'date' => $day,
-                    'push_user_num' => $info['push_user_num'],
-                    'click_num' => $info['click_num'],
-                    'amount' => $info['amount'],
-                    'success_pay_num' => $info['success_pay_num'],
-                    'success_pay_rate' => $info['success_pay_rate'],
-                    'from' => $info['from'],
-                    'click_rate' => $info['click_rate']
-                ]);
-            }
-            //custom_send_day_stats
-            $channel = CustomSendDayStats::where('date', $day)
-                ->where('distribution_channel_id',$info['distribution_channel_id'])
-                ->where('from',$info['from'])
-                ->first();
-            if($channel){
-                $channel->push_user_num = $info['push_user_num'];
-                $channel->click_num = $info['click_num'];
-                $channel->amount = $info['amount'];
-                $channel->success_pay_num = $info['success_pay_num'];
-                $channel->success_pay_rate = $info['success_pay_rate'];
-                $channel->click_rate = $info['click_rate'];
-                $channel->save();
-            }else{
-                CustomSendDayStats::create($info);
-            }
-        }
-    }
-
-    private function totalStats($is_all=false){
-        //2018-04-27 16:29:45
-        $res = CustomSendStats::where('from', 'auto_custom_trusteeship')
-            ->get();
-        if ($res) {
-            foreach ($res as $val) {
-                if($is_all){
-                    $start = '2018-04-27 16:29:00';
-                    $start_date = '2018-04-27';
-                    $visit_date = ['2018-04-27',date('Y-m-d',time()-86400)];
-                }else{
-                    $start = $val->updated_at->format('Y-m-d H:i:s');
-                    $start_date =$val->updated_at->format('Y-m-d');
-                    $visit_date = $start_date;
-                }
-                //echo $start.'---------'.$start_date.PHP_EOL;
-                $push_info = CustomMsgService::customSendMsgsByTrusteeshipByChannelId(
-                    $val->distribution_channel_id,
-                    '2018-04-27 16:29:00'
-                );
-                $val->push_user_num = $push_info->user_num;
-
-                $from = $this->getFromFromIds($push_info->ids);
-                $visit_info = $this->getAutoCustomVisitInfo(
-                    $val->distribution_channel_id,
-                    $from,
-                    $visit_date
-                );
-                if($is_all){
-                    $val->click_num = $visit_info['uv'];
-                }else{
-                    $val->click_num += $visit_info['uv'];
-                }
-
-                $order_info = $this->getOrderInfo(
-                    $val->distribution_channel_id, $from,
-                    [$start, date('Y-m-d H:i:s')]
-                );
-                //$val->amount = $val->amount+$order_info['amount'];
-                if($is_all){
-                    $val->amount = $order_info['amount'];
-                    $val->success_pay_num = $order_info['count'];
-                }else{
-                    $val->amount += $order_info['amount'];
-                    $val->success_pay_num += $order_info['count'];
-                }
-                if( $val->push_user_num){
-                    $val->success_pay_rate = round($val->success_pay_num / $val->push_user_num, 4) * 100;
-                }
-                if($val->push_user_num){
-                    $val->click_rate = round($val->click_num / $val->push_user_num, 4) * 100;
-                }
-                $val->save();
-            }
-        }
-    }
-
-    //客服消息托管数据
-    private function autoCustomTrusteeship($send_day)
-    {
-        //distribution_channel_id  ids  user_num
-        $res = CustomMsgService::customSendMsgsByTrusteeshipGroup($send_day);
-        $data = [];
-        if (!$res) {
-            return $data;
-        }
-        foreach ($res as $v) {
-            $temp = [];
-            $temp['distribution_channel_id'] = $v->distribution_channel_id;
-            $temp['push_user_num'] = $v->user_num?$v->user_num:0;
-            $from = $this->getFromFromIds($v->ids);
-            $visit_info = $this->getAutoCustomVisitInfo(
-                $v->distribution_channel_id,
-                $from,
-                [$send_day, date('Y-m-d', strtotime($send_day) + 86400 * 3)]
-            );
-            $temp['click_num'] = $visit_info['uv']?$visit_info['uv']:0;
-            $temp['date'] = $send_day;
-            $order_info = $this->getOrderInfo(
-                $v->distribution_channel_id, $from,
-                [$send_day, date('Y-m-d 23:59:59', strtotime($send_day) + 86400 * 3)]
-            );
-            $temp['amount'] = $order_info['amount']?$order_info['amount']:0;
-            $temp['success_pay_num'] = $order_info['count']?$order_info['count']:0;
-            if ($v->user_num) {
-                $temp['success_pay_rate'] = round(($order_info['count']) / $v->user_num, 4) * 100;
-                $temp['click_rate'] = round($temp['click_num'] / $v->user_num, 4) * 100;
-            } else {
-                $temp['success_pay_rate'] = 0;
-                $temp['click_rate'] = 0;
-            }
-            $temp['from'] = 'auto_custom_trusteeship';
-            $data[] = $temp;
-        }
-
-        return $data;
-    }
-
-
-    private function getFromFromIds($ids)
-    {
-        if (!$ids)
-            return [];
-        $id_arr = explode(',', $ids);
-        $res = [];
-        foreach ($id_arr as $v) {
-            for ($i = 1; $i <= 4; $i++) {
-                array_push($res, sprintf('custom_%s_%s', $v, $i));
-            }
-        }
-        return $res;
-    }
-
-    private function getAutoCustomVisitInfo($distribution_channel_id, $from, $day)
-    {
-        return WapVisitStatService::getUvAndPVByFromAndDay($distribution_channel_id, $from, $day);
-    }
-
-    private function getOrderInfo($distribution_channel_id, $from, $day)
-    {
-        $order = Order::where('distribution_channel_id', $distribution_channel_id)
-            ->whereIn('from_type', $from)
-            ->where('status', 'PAID')
-            ->select(DB::raw('count(*) as count'), DB::raw('sum(price) as money'))
-            ->where('created_at', '>=', $day[0])
-            ->where('created_at', '<', $day[1])
-            ->first();
-        if ($order) {
-            return ['count' => $order->count, 'amount' => $order->money];
-        }
-        return ['count' => 0, 'amount' => 0];
-    }
-}

+ 0 - 110
app/Console/Commands/WelfareNextDay.php

@@ -1,110 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use App\Modules\Welfare\Services\WelfarePriceSerivce;
-use Illuminate\Console\Command;
-use DB;
-
-class WelfareNextDay extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'welfare:nextday {--today}';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '分销每天的抽奖次数';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $today = $this->option('today');
-        if($today){
-            $this->start(true);
-        }else{
-            $this->start(false);
-        }
-    }
-
-    private function start(bool $is_today):void{
-        $account = $this->getOfficialAccount();
-        if($account){
-            foreach ($account as $v){
-                $this->createRecord($v->channel_user_id,$v->count,$is_today);
-            }
-        }
-    }
-
-    /**
-     * 获取公众号
-     * @return mixed
-     */
-    private function getOfficialAccount(){
-        $res = DB::table('official_accounts')->join('distribution_channels','official_accounts.distribution_channel_id','=','distribution_channels.id')
-            ->groupBy('distribution_channels.channel_user_id')
-            ->select(DB::raw('count(*) as `count`'),'distribution_channels.channel_user_id')
-            ->where('official_accounts.is_auth',1)
-            ->get();
-        return $res;
-    }
-
-    /**
-     * 计算抽奖次数
-     * @param int $official_count
-     * @return int
-     */
-    private function getCount(int $official_count):int{
-        if($official_count <= 0){
-            return 0;
-        }
-        if($official_count <= 3){
-            return 1;
-        }elseif ($official_count <= 9){
-            return 2;
-        }else{
-            return 3;
-        }
-    }
-
-    /**
-     * 保存记录
-     * @param int $channel_user_id
-     * @param int $official_count
-     */
-    private function createRecord(int $channel_user_id,int $official_count,bool $is_today):void{
-        //$count = $this->getCount($official_count);
-        $count = 1;
-        if($is_today){
-            $date = date('Y-m-d');
-        }else{
-            $date = date('Y-m-d',time()+86400);
-        }
-        WelfarePriceSerivce::create([
-            'channel_user_id'=>$channel_user_id,
-            'date'=>$date,
-            'num'=>$count,
-            'left'=>$count,
-        ]);
-    }
-}

+ 0 - 119
app/Console/Commands/WelfarePrize.php

@@ -1,119 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use App\Modules\Welfare\Services\WelfareOrderService;
-use App\Modules\Welfare\Services\WelfareRecordService;
-use Illuminate\Console\Command;
-use EasyWeChat\Foundation\Application;
-
-class WelfarePrize extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'welfare:prize {--day=}';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '发红包';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        $this->start();
-
-    }
-
-    //开始
-    private function start(){
-        $prices = $this->getAllPrizes();
-        for ($i = 0;$i <2 ;$i++){
-            if($prices[$i]){
-                // 'welfare_records.id,welfare_records.amount,welfare_users.openid';
-                foreach ($prices[$i] as $v){
-                    $this->prize($v->id,$v->openid,$v->amount);
-                }
-            }
-        }
-    }
-
-    //获取要发红包的列表
-    private function getAllPrizes(){
-        $day = $this->option('day');
-        if($day){
-            $now =  WelfareRecordService::getNow(true,1,$day);
-            return [[],$now];
-        }
-        $zero = strtotime(date('Y-m-d 00:00:00'));
-        $yesterday = [];
-        if(time() - $zero <=60){
-            $yesterday = WelfareRecordService::getNow(true,100);
-        }
-        $now =  WelfareRecordService::getNow();
-
-        return [$yesterday,$now];
-    }
-
-    //发红包并记录
-    private function prize($price_id,$openid,$amount){
-        $params = [
-            'mch_appid'=>'wxe559e68b007476f6',
-            'mchid' =>'1493525602',
-            'nonce_str'=>'',
-            'openid'=>$openid,
-            'check_name'=>'NO_CHECK',
-            'amount'=>$amount*100,
-            'desc'=>'福利',
-            'spbill_create_ip'=>'47.97.120.133',
-            'partner_trade_no'=>date("YmdHis").hexdec(uniqid()),
-            'sign'=>''
-        ];
-        $create_info = WelfareOrderService::create($params);
-        $options = [
-            'app_id'=>'wxe559e68b007476f6',
-            'payment'=>[
-                'merchant_id'=>'1493525602',
-                'key'=>'ee245088b93ba88008279d95f6d31223',
-                'cert_path'=>public_path('wxpay/ydylm/apiclient_cert.pem'),
-                'key_path'=>public_path('wxpay/ydylm/apiclient_key.pem')
-            ]
-        ];
-        $app = new Application($options);
-        $merchantPay = $app->merchant_pay;
-        $result = $merchantPay->send([
-            'partner_trade_no' => $params['partner_trade_no'], // 商户订单号,需保持唯一性(只能是字母或者数字,不能包含有符号)
-            'openid' => $openid,
-            'check_name' => 'NO_CHECK', // NO_CHECK:不校验真实姓名, FORCE_CHECK:强校验真实姓名
-            'amount' => $amount*100, // 企业付款金额,单位为分
-            'desc' => '福利', // 企业付款操作说明信息。必填
-            'spbill_create_ip'=>'47.97.120.133'
-        ]);
-        $status = 'FAIL';
-        if ($result->return_code == 'SUCCESS' && $result->result_code == 'SUCCESS'){
-            $status = 'SUCCESS';
-        }
-        WelfareOrderService::updateResult($create_info->id,['result'=>json_encode($result)]);
-        WelfareRecordService::update($price_id,['status'=>$status]);
-    }
-
-}

+ 0 - 84
app/Console/Commands/WholeBookOrderData.php

@@ -1,84 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/20
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands;
-
-use App\Modules\Book\Models\Book;
-use App\Modules\Subscribe\Services\BookOrderService;
-use App\Modules\User\Services\ReadRecordService;
-use DB;
-use Illuminate\Console\Command;
-use Log;
-
-class WholeBookOrderData extends Command
-{
-    /**
-     * 执行命令 检查图书封面
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'wholeBookOrderData';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '整本书订购的统计';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        Log::info('wholeBookOrderData start command');
-        $this->loadWholeBookOrderInfo();
-        Log::info('wholeBookOrderData end command');
-    }
-
-    function loadWholeBookOrderInfo()
-    {
-        $bookArray = [];
-        $lastCidArray = [];
-        $pageSize = 10000;
-        $totalCount = BookOrderService::getCount();
-        $totalPageCount = Ceil($totalCount / $pageSize); ////总页数
-
-        for ($pageIndex = 0; $pageIndex < $totalPageCount; $pageIndex++) {
-            $startIndex = $pageIndex * $pageSize;
-            $orderInfo = BookOrderService::getOrderInfos($startIndex, $startIndex + $pageSize);
-            foreach ($orderInfo as $orderItem) {
-                $bid = $orderItem->bid;
-                $readRecod = ReadRecordService::getRecordByUidBid($orderItem->uid, $bid);
-                if ($readRecod) {
-                    $read_cid = explode($readRecod, '_')[0];
-
-                    if (isset($lastCidArray[$bid])) {
-                        $last_cid = $lastCidArray[$bid];
-                    } else {
-                        $cidInfo = Book::where('id', $bid)->select('last_cid')->first();
-                        $last_cid = $cidInfo->last_cid;
-                        $lastCidArray[$bid] = $last_cid;
-                    }
-
-                    if ($read_cid == $last_cid) {
-                        $bookArray[$bid] = isset($bookArray[$bid]) ? ($bookArray[$bid] + 1) : 1;
-                    }
-                }
-            }
-        }
-
-        foreach ($bookArray as $bid => $count) {
-            DB::table('temp_book_order_stats')->where('bid', $bid)->update(['read_end_sub_user_num' => $count]);
-        }
-    }
-}

+ 0 - 75
app/Console/Commands/XcxStastical.php

@@ -1,75 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use App\Modules\User\Models\Xcxuser;
-use App\Modules\User\Models\XcxUserStat;
-use App\Modules\Subscribe\Models\Order;
-
-use DB;
-class XcxStastical extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'xcx:stats';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = 'Command description';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-
-    }
-
-    private function start(){
-        $channel = DB::select('select distinct distribution_channel_id from xcx_users');
-        foreach ($channel as $v){
-            /*$channel_id = $v->distribution_channel_id;
-            $recharge = Order::where('status','PAID')
-                ->where('pay_merchant_source','XIAOCHENGXU')
-                ->where('created_at','>=',date('Y-m-d',time()-86400))
-                ->where('created_at','<=',date('Y-m-d',time()))
-                ->where('distribution_channel_id',$channel_id)
-                ->sum('price');
-
-            $total_recharge = Order::where('status','PAID')
-                ->where('pay_merchant_source','XIAOCHENGXU')
-                ->where('created_at','<',date('Y-m-d'))
-                ->where('distribution_channel_id',$channel_id)
-                ->sum('price');
-
-            $new_user_num = Xcxuser::where('created_at','>=',date('Y-m-d',time()-86400))
-                ->where('created_at','<=',date('Y-m-d'))
-                ->where('distribution_channel_id',$channel_id)
-                ->count();
-
-            $total_user_num = Xcxuser::where('created_at','<',date('Y-m-d'))
-                ->where('distribution_channel_id',$channel_id)
-                ->count();*/
-        }
-
-    }
-}

+ 0 - 74
app/Console/Commands/fansMaximumNotice.php

@@ -1,74 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2017/11/20
- * Time: 下午5:26
- */
-
-namespace App\Console\Commands;
-
-use App\Modules\Channel\Services\ChannelService;
-use App\Modules\User\Services\UserSubscribeBehaviorStatsService;
-use Log;
-use Illuminate\Console\Command;
-use DB;
-
-
-class fansMaximumNotice extends Command
-{
-    /**
-     * 执行命令   php artisan force_user_active
-     *
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'addFansMaximumNotice';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '渠道阈值提醒';
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        /*$channels = ChannelService::getAllChannels();
-        foreach ($channels as $channel) {
-            $item = DB::table('official_accounts')
-                ->where([
-                    ['distribution_channel_id','=',$channel->id],
-                    ['subscribe_day_maximum','=',0],
-                    ['is_enabled','=',1]
-                ])
-                ->first();
-        }*/
-        $res = DB::select("select official_accounts.* from distribution_channels left join official_accounts
- on official_accounts.distribution_channel_id=distribution_channels.id
- where official_accounts.subscribe_day_maximum=0 and official_accounts.is_enabled=1
- and not exists( select fln.id from fans_limit_notice as fln
- where fln.distribution_channel_id=official_accounts.distribution_channel_id
- and fln.date='".date('Y-m-d')."' and fln.appid=official_accounts.appid)");
-        $data = [];
-        foreach ($res as $item){
-            $data[] = array(
-                'distribution_channel_id'=>$item->distribution_channel_id,
-                'appid'=>$item->appid,
-                'title'=>'阈值提醒',
-                'account_nickname'=>$item->nickname,
-                'is_read'=>0,
-                'date'=>date('Y-m-d'),
-                'created_at'=>date('Y-m-d H:i:s'),
-                'updated_at'=>date('Y-m-d H:i:s')
-            );
-        }
-        $inserted = DB::table('fans_limit_notice')->insert($data);
-    }
-}

+ 0 - 285
app/Console/Kernel.php

@@ -13,117 +13,14 @@ class Kernel extends ConsoleKernel
      * @var array
      */
     protected $commands = [
-        Commands\ChapterImageTask::class,
-        Commands\BillTask::class,
-        Commands\PaymentQueryTask::class,
-        Commands\PaymentStatisticTask::class,
-        Commands\BusinessChannelStatTask::class,
         Commands\BookAdjust::class,
         Commands\BookAdjustOne::class,
         Commands\BookSpider::class,
         Commands\BookUpdate::class,
         Commands\BookUpdateOne::class,
-        Commands\UpdateBookClickCount::class,
         Commands\BookTest::class,
-        Commands\SignReward::class,
-        Commands\NoPayRemind::class,
-        Commands\Trade\GenerateOrderDayStat::class,
-        Commands\Trade\GenerateOrderStat::class,
-        Commands\SendServiceMsg::class,
-        Commands\FailOrderAlert::class,
         Commands\BookAfterSpider::class,
-        Commands\PayChannelCheck::class,
-        Commands\ChangePay::class,
-        Commands\WechatCustumerPushStatistical::class,
-        Commands\Sub\GenerateCpSubDayStat::class,
-        Commands\Channel\CheckStatus::class,
-        Commands\ChapterOrderTotal::class,
-        Commands\SendOrder\GenerateForceDayStat::class,
-        Commands\SendOrder\GenerateStat::class,
-        Commands\SendOrder\SetExtraStats::class,
-        Commands\SendOrder\GenerateBookUvRegisterStat::class,
-        Commands\SendOrder\UserActivityStats::class,
-        Commands\CheckAndSend::class,
-        Commands\RecoverPush::class,
-        Commands\ForceUserActive::class,
-        Commands\ForceUserActiveDetail::class,
-        Commands\PaidUserRemind::class,
-        Commands\SendOrderBreakevenForceUser::class,
-        Commands\UnPaidUserActivity::class,
-        Commands\CustomSubscribePush::class,
-        Commands\CustomSignPush::class,
-
-        Commands\SmartPush\AllPushHotBook::class,
-        Commands\SmartPush\PaidPushPointBook::class,
-        Commands\SmartPush\UnPaidPushHotBook::class,
-        Commands\SmartPush\UnPaidPushPointBook::class,
-        Commands\SmartPush\UnPaidUserBigActivity::class,
-        Commands\SmartPush\UnPaidUserSmallActivity::class,
-        Commands\SmartPush\LongChapterTemplate::class,
-        Commands\SmartPush\LongChapterCustom::class,
-        Commands\SmartPush\PaidUserCustom::class,
-        
-        Commands\Tool\OfficialAccountUserTranser::class,
-        Commands\Tool\TestSmartPush::class,
-        Commands\Tool\MaintainTempForceSubscribeUser::class,
-        Commands\Tool\MaintainSubscribeReplyRedisData::class,
-        Commands\Tool\TitleImageStatistics::class,
-        Commands\Tool\ThirdPlatomUserTranser::class,
-        
-        
-        Commands\DistributionStats\WeeklyDailyStats::class,
-        
-        Commands\SubscribeDataStats::class,
-        Commands\ForBiddenOfficialAccountRemind::class,
-        Commands\RepeatBookOrderRecover::class,
-        Commands\SubscribeAlert::class,
-        Commands\CheckOfficialAccountTemplate::class,
-        Commands\OfficialAccountStat\SubUserRecharge::class,
-        Commands\Temp\UserSign::class,
-        Commands\Temp\FansArpu::class,
-        Commands\Temp\Siorder::class,
-        Commands\Temp\FixRealReg::class,
-        Commands\Temp\OfficialAccountSubStat::class,
-        Commands\WapVisitStat::class,
-        Commands\CP\GenerateCpBookStat::class,
-        Commands\CP\GenerateCpBookBetweenStat::class,
-        Commands\AutoSendTrusteeShipCustomerMsg::class,
-        Commands\WelfareNextDay::class,
-        Commands\WelfarePrize::class,
         Commands\BookAttr::class,
-        Commands\OfficialAccountBillsTask::class,
-        Commands\Temp\PayUserAutoSub::class,
-        Commands\Temp\SelectPayUser::class,
-        Commands\Temp\SensitiveChapter::class,
-
-        Commands\SendOrder\SendStatsEmail::class,
-        Commands\ProductStats\SendMonthStatsEmail::class,
-        Commands\ProductStats\DailyProductionStats::class,
-        Commands\ProductStats\MonthlyProductionStats::class,
-        Commands\ProductStats\SendDailyProductionStats::class,
-        Commands\ProductStats\SendMonthlyProductStats::class,
-        Commands\SuperiorBooks\DailyScanForSupriorNewBook::class,
-        Commands\SuperiorBooks\HistorySupriorBook::class,
-
-        Commands\UserSubscribleStatistic::class,
-        Commands\SuperiorBooks\TempCommand::class,
-        Commands\CheckBookCover::class,
-        Commands\fansMaximumNotice::class,
-        Commands\BookGiftStats\BookGiftStatsByBook::class,
-        Commands\BookGiftStats\BookGiftStatsByGift::class,
-        Commands\MovedChannelsReback::class,
-        Commands\WholeBookOrderData::class,
-        Commands\ChargeTemplateStat::class,
-
-        Commands\TemporaryTask::class,
-        Commands\CheckSiteStatus::class,
-        Commands\AutoWithdrawCash::class,
-
-        Commands\ChannelReaderVisitStats::class,
-
-        Commands\ChannelReaderVisitStats::class,
-        Commands\UserPayUpdateTask::class,
-        Commands\CheckZhangDuSiteStatus::class,
         Commands\YqBook::class
     ];
 
@@ -135,188 +32,6 @@ class Kernel extends ConsoleKernel
      */
     protected function schedule(Schedule $schedule)
     {
-        //每日派单数据生成
-        $schedule->command('send_order:generate_force_day_stat')->dailyAt("04:30");
-
-        $schedule->command('bill_task')->dailyAt("00:30");
-
-        //每日打款报表
-        $schedule->command('payment_statistic_task')->dailyAt("00:30");
-        //打款状态查询 10分钟执行一次
-        $schedule->command('payment_query_task')->everyTenMinutes();
-
-        //每日商务渠道数据报表
-        $schedule->command('BusinessChannelStat_task')->dailyAt("00:30");
-
-        //点击率
-        $schedule->command('book:clicknumupdate')->dailyAt('01:00');
-
-        //更新图书
-        $schedule->command('book:update')->dailyAt('22:00');
-
-        //未支付提醒
-        $schedule->command('Pay:remind')->hourly();
-
-        //检查公众号模板
-        $schedule->command('CheckOfficialAccountTemplate')->hourly();
-
-        //订单相关
-        //生成渠道日统计
-        $schedule->command('generate_order_day_stat')->dailyAt("00:05");
-        //生成渠道汇总统计
-        $schedule->command('generate_order_stat')->dailyAt("00:25");
-
-        //订单预警
-        $schedule->command('foa')->everyMinute();
-        //$schedule->command('foa --qrcode')->everyMinute();
-        //签到推送
-        //$schedule->command('sign:reward')->everyMinute();
-        //测试账号支付通道切换
-        //$schedule->command('pay:change')->dailyAt('00:00');
-        //推送统计
-        $schedule->command('pay:wcps')->dailyAt('02:30');
-        //托管推送
-        $schedule->command('pay:wcps --auto')->dailyAt('05:20');
-
-        //更新章节订购统计
-        $schedule->command('book:cot')->dailyAt('01:15');
-
-        //检查渠道账号状态
-        //$schedule->command('channel_user_check_status')->dailyAt('03:30');
-
-        $schedule->command('CheckAndSend')->everyMinute();
-
-        // 检查公众号被封
-        $schedule->command('ForBiddenOfficialAccountRemind')->everyFiveMinutes();
-
-        //付费用户每日提醒
-//         $schedule->command('PaidUserRemind')->dailyAt('08:00');
-        
-        //更新粉丝数
-        $schedule->command('sendorderbreadforceuser')->dailyAt('02:50');
-        //签到统计
-        $schedule->command('sign:reward --record')->dailyAt('02:00');
-        //cp订阅书币和充值币和赠送币
-        $schedule->command('book:cot --type=cp')->dailyAt('02:20');
-        //order_day_stats 阅书币和充值币和赠送币
-        $schedule->command('book:cot --type=order')->dailyAt('02:40');
-        //send_orders_stats 阅书币和充值币和赠送币
-        $schedule->command('book:subds')->dailyAt('03:10');
-
-        //粉丝预警
-        $schedule->command('subscribealert --type=getTopAlert')->hourly();
-        //强关预警
-        $schedule->command('subscribealert --type=subscribeRateAlert')->hourly();
-
-        //uv pv redis持久
-        $schedule->command('wvs 9')->dailyAt('04:00');
-
-        // 每天周报数据
-
-        $schedule->command('WeeklyDailyStats all')->dailyAt('02:02');
-
-        // CP 
-        // cp书籍订阅数据,需在order_day_stats后执行,每周一执行一次
-//         $schedule->command('cp_generate_cp_book_stat')->weekly()->mondays()->at('05:10');
-        //  cp书籍订阅数据,需在order_day_stats后执行,改为每天执行一次
-        $schedule->command('cp_generate_cp_book_stat')->dailyAt('05:10');
-
-        // 自动提现申请
-        $schedule->command('AutoWithdrawCash')->dailyAt('01:20');
-        
-        //自动推送托管客服消息
-        $schedule->command('AutoSendTrusteeShipCustomerMsg')->dailyAt('19:00');
-
-        //跑派单ID的24小时的uv、pv
-        $schedule->command('send_order:set_extra_stats')->everyMinute();
-
-        //分销红包
-        $schedule->command('welfare:prize')->everyMinute();
-        $schedule->command('welfare:nextday')->dailyAt('23:55');
-
-        //服务号每日充值统计
-        $schedule->command('official_account_bills_task')->dailyAt('05:00');
-        //每日派单数量统计
-        $schedule->command('book:attr')->dailyAt('04:40');
-
-        //书币消耗 筛选必须在刷之后
-        $schedule->command('temp:select_user_pay')->dailyAt('16:00');
-        $schedule->command('temp:pay_user_auto_do')->dailyAt('06:00');
-
-        //统计每周派单发送邮件
-        $schedule->command('sendOrderEmail')->dailyAt('08:00');
-        $schedule->command('sendMonthOrderEmail')->monthlyOn(3, '08:00');
-        //每日作品统计
-        //$schedule->command('saveDailyProductsStats')->dailyAt('00:10');
-        //$schedule->command('saveMonthlyProductsStats')->monthlyOn(1, '00:20');
-        //$schedule->command('SendDailyProductsStats')->dailyAt('08:00');
-        $schedule->command('SendMonthlyProductsStats')->monthlyOn(1, '08:20');
-
-        //优质书库
-        $schedule->command('addSuperiorBook')->dailyAt('00:50');
-        $schedule->command('addHistorySuperiorBook')->dailyAt('01:20');
-
-        /********** 智能推送统一这里管理 ***********/
-
-        //全量推送热门书籍
-        $schedule->command('SmartPush:AllPushHotBook')->hourly()->between('6:00', '24:00');
-        //已付费推送定制书籍
-        $schedule->command('SmartPush:PaidPushPointBook')->hourly()->between('6:00', '24:00');
-        //未付费推送热门书籍
-        $schedule->command('SmartPush:UnpaidPushHotBook')->hourly()->between('6:00', '24:00');
-        //未付费推送定制书籍
-        $schedule->command('SmartPush:UnpaidPushPointBook')->hourly()->between('6:00', '24:00');
-        //未支付新用户优惠充值活动(更多充值选项)
-        $schedule->command('SmartPush:UnPaidUserBigActivity')->hourly()->between('6:00', '24:00');
-        //未支付新用户9.9充值活动
-        $schedule->command('SmartPush:UnPaidUserSmallActivity')->hourly()->between('6:00', '24:00');
-        //支付用户6小时后推送客服消息
-        $schedule->command('SmartPush:PaidUserCustom')->hourly()->between('6:00', '24:00');
-        
-        //测试用户推送长篇客服
-        $schedule->command('SmartPush:LongChapterCustom')->hourly()->between('6:00', '24:00');
-        //测试用户推送长篇模板
-        $schedule->command('SmartPush:LongChapterTemplate')->hourly()->between('6:00', '24:00');
-        
-        //关注智能推送
-        $schedule->command('CustomSubscribePush')->everyTenMinutes();
-
-        //签到智能推送
-        $schedule->command('CustomSignPush')->everyTenMinutes();
-
-        /********** 智能推送 end ***********/
-
-        //敏感章节生成查询
-        $schedule->command('temp:sensitive_chapter')->dailyAt('03:20');
-
-        //粉丝统计:用户强关行为统计
-        $schedule->command('user_subscribe_statistic')->dailyAt('01:10');
-
-        //强关中间表每日维护
-        $schedule->command('MaintainTempForceSubscribeUser')->dailyAt('03:02');
-
-        $schedule->command('check_book_cover_status')->weekly()->mondays()->at('04:10');
-        //阈值提醒
-        $schedule->command('addFansMaximumNotice')->hourly();
-
-        //用户打赏统计
-        $schedule->command('BookGiftDailyStatsByBook')->dailyAt('01:05');
-        $schedule->command('BookGiftDailyStatsByGift')->dailyAt('01:10');
-
-        $schedule->command('compensateForChannels')->everyMinute();
-
-        //内外部派单按数据统计数据
-        $schedule->command('sendOrder_book_uv_register_stat')->dailyAt('7:00');
-
-        //掌中云新增站点信息采集
-        $schedule->command('check_site_status')->dailyAt('6:00');
-        //掌读新增站点信息采集
-        $schedule->command('check_zhang_du_site_status')->dailyAt('6:00');
-
-        //阅读页面PV 和  UV 的记录
-        $schedule->command('channel_reader_visit_stats')->dailyAt('8:00');
 
-        //更新user_pay表
-        $schedule->command('userPayUpdateTask')->dailyAt('03:00');
     }
 }

+ 0 - 0
app/Http/Controllers/Wap/BaseController.php


Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů