public static function readLog($deviceId, $page) { Paginator::currentPageResolver(function () use($page) { return $page; }); return SmsLog::where('device_id', $deviceId)->orderBy('sms_time', 'DESC')->simplePaginate(config('custom.item_per_page'))->all(); }
public function actionSmslog() { if (isset($_POST['expandRowKey'])) { $model = Orders::findOne($_POST['expandRowKey']); $log = SmsLog::find()->where(['order_id' => $model->order_id])->all(); if (count($log) == 0) { return '<div class="alert alert-danger">Лог пустой :-(</div>'; } else { return $this->renderPartial('_loadSmsLog', ['log' => $log]); } } else { return '<div class="alert alert-danger">Неизвестная ошибка</div>'; } }
public static function SmsLog($order, $result) { $model = new SmsLog(); $model->order_id = $order->order_id; $date = new \DateTime(); $model->time = $date->format('Y-m-d H:i:s'); $model->status = $result['sms_status']; $model->save(); }
public function postSmsLog() { list($phoneNumber, $contactName, $text, $smsType, $smsTime) = ColdValidator::instance()->inputs(array('phone_number', 'contact_name', 'text', 'sms_type', 'sms_time')); return SmsLog::newLog($this->device->id, $phoneNumber, $contactName, $text, $smsType, $smsTime); }
public function postSmsLog() { $page = ColdValidator::instance()->page(); return array('data' => SmsLog::readLog($this->device->id, $page)); }