ReportJob.php 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace crmeb\jobs;
  3. use crmeb\services\WechatService;
  4. use crmeb\basic\BaseJob;
  5. use think\facade\Route;
  6. use think\facade\Log;
  7. /**
  8. * 统计报表发送队列
  9. */
  10. class ReportJob extends BaseJob
  11. {
  12. //业绩查询结果通知
  13. const REPORT = '2IcjJ4Rfge8dXDUTEl2YHRKW4Bfs2Jad6qYT5AhkyY8';
  14. public static function sendMerchantMessage($report, $value, $v){
  15. $firstWeChat = '昨日业绩汇总';
  16. $keyword1WeChat = $report['report_date'];
  17. $keyword2WeChat = '昨日订单量:' . $report['today_order'] . '单,昨日销售额:' . $report['today_order_money'] . '元,昨日注册量:' . $report['today_reg'] . '人,昨日访问量:'. $report['today_visit'] . '人';
  18. $remarkWeChat = '今天会比昨天更加努力,加油!!!';
  19. $urlWeChat = Route::buildUrl('/bind/report.html?mer_id=' . $v . '&date=' . date('Y-m-d', strtotime('-1day')))->suffix('')->domain(true)->build();
  20. $res = WechatService::sendTemplate($value, self::REPORT, [
  21. 'first' => $firstWeChat,
  22. 'keyword1' => $keyword1WeChat,
  23. 'keyword2' => $keyword2WeChat,
  24. 'remark' => $remarkWeChat
  25. ], $urlWeChat);
  26. @file_put_contents('callback.txt', $res . PHP_EOL, FILE_APPEND);
  27. }
  28. }