| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- // +----------------------------------------------------------------------
- // | 文件说明:幻灯片
- // +----------------------------------------------------------------------
- // | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Author: wuwu <15093565100@163.com>
- // +----------------------------------------------------------------------
- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
- // +----------------------------------------------------------------------
- // | Date: 2017-5-25
- // +----------------------------------------------------------------------
- namespace api\crontab\controller;
- use api\common\Sms;
- use app\talent\model\TalentAppointmentLogModel;
- use app\talent\model\TalentAppointmentModel;
- class TalentController
- {
- /**
- * 主方法
- */
- public function index()
- {
- $this->_dealRateMsg();
- // $this->_test();
- }
- /**
- * 发送短信
- */
- public function _dealRateMsg()
- {
- $yesterday = date('Y-m-d', strtotime('-1 day'));
- $list = TalentAppointmentLogModel::with(['appointment.talent'])
- ->where(function($query){
- $query->where('content', '通过手机号接站,接到了人才')->whereOr('content','通过扫码接站,接到了人才');
- })
- ->whereBetween('create_time', [$yesterday . ' 00:00:00', $yesterday . ' 23:59:59'])
- ->select();
- //短信
- $sms = new Sms();
- if (!$list->isEmpty()) {
- foreach ($list as $v) {
- $sms->send($v['appointment']['talent']['mobile'],'talent_appointment_end');
- }
- }
- }
- public function _test()
- {
- $today = date('Y-m-d');
- $list = TalentAppointmentModel::where('out_time','between',[$today.' 00:00:00',$today.' 23:59:59'])->order('out_time asc')->select();
- $res = [];
- foreach ($list as $v) {
- $hour = date('H:00',strtotime($v['out_time']));
- if (empty($res)) {
- $res[$hour] = [
- 'hour' => $hour,
- 'list' => [],
- ];
- }
- $res[$hour]['list'][] = $v->toArray();
- }
- halt(array_values($res));
- }
- }
|