__('Message_type 0'),'1' => __('Message_type 1')]; } public function getOfficialAccountTypeList() { return ['0' => __('Official_account_type 0'),'1' => __('Official_account_type 1')]; } public function getStatusList() { return ['0' => __('Status 0'),'1' => __('Status 1'),'2' => __('Status 2')]; } public function getMessageTypeTextAttr($value, $data) { $value = $value ? $value : $data['message_type']; $list = $this->getMessageTypeList(); return isset($list[$value]) ? $list[$value] : ''; } public function getOfficialAccountTypeTextAttr($value, $data) { $value = $value ? $value : $data['official_account_type']; $list = $this->getOfficialAccountTypeList(); return isset($list[$value]) ? $list[$value] : ''; } public function getSendtimeTextAttr($value, $data) { $value = $value ? $value : $data['sendtime']; return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } public function getStatusTextAttr($value, $data) { $value = $value ? $value : $data['status']; $list = $this->getStatusList(); return isset($list[$value]) ? $list[$value] : ''; } protected function setSendtimeAttr($value) { return $value && !is_numeric($value) ? strtotime($value) : $value; } /** * 逻辑删除素材 * @param $mediaId 素材ID * @return int|bool */ public function deleteMediaPush($mediaPushId) { return $this->save(['status' => Custom::CUSTOM_MEDIA_PUSH_STATUS_DELETE], ['id' => $mediaPushId]); } /** * @param $id custom_media_push 表中的ID * @return array * @throws \think\Exception * @throws \think\exception\DbException */ public function getCustomInfoById($id) { $data = $this->get(['id'=>$id])->toArray(); return $data; } }