迅睿開源框架是一款PHP8高性能·簡(jiǎn)單易用的PHP開源開發(fā)框架, 基于MIT開源許可協(xié)議發(fā)布,不限制商業(yè)使用,以多端互聯(lián)為設(shè)計(jì)理念, 支持的微信公眾號(hào)、小程序、APP客戶端、移動(dòng)端網(wǎng)站、PC網(wǎng)站等多終端式管理系統(tǒng)。
業(yè)務(wù)經(jīng)理
微信掃描以上二維碼
028-61286886
技術(shù)咨詢
會(huì)員中心,會(huì)員編輯文章,不想讓他更新編輯的時(shí)間,怎么寫?
后臺(tái)可以寫Models繼承,會(huì)員中心那里好像不能
用這個(gè)方法
參考文檔:《用戶中心模塊控制器繼承重寫》
開源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!
回復(fù)迅睿框架創(chuàng)始人
我在這個(gè)文件里寫了 _Data
但是…… 好像提交過去,他依舊是走到 \dayrui\App\模塊\Models\Content.php
而且,因?yàn)槭蔷庉?,好像?huì)員中心提交的內(nèi)容,不參與 inputtime字段修改!
我打印出來沒有inputtime 字段,但是我 在會(huì)員中心都模板里已經(jīng)加了
<input name="inputtime" type="hidden" value="{$inputtime}">
dayrui/App/Demo/Controllers/Member/Home.php
上面這個(gè)文件打印出來是有inputtime
他接著要繼續(xù)走到 \dayrui\App\模塊\Models\Content.php
這里打印出來就丟失了 inputtime
/** * 獲取內(nèi)容 * $id 內(nèi)容id,新增為0 * */ protected function _Data($id = 0) { // 判斷是否來至審核 if (defined('IS_MODULE_VERIFY')) { $row = \Phpcmf\Service::M()->table(SITE_ID.'_'.$this->module['dirname'].'_verify')->get($id); if (!$row) { return []; } elseif ($this->uid != $row['uid']) { return []; } $data = dr_string2array($row['content']); $data['backinfo'] = dr_string2array($row['backinfo']); !$this->is_get_catid && $this->is_get_catid = (int)$row['catid']; // 欄目驗(yàn)證碼 $this->is_post_code = $this->is_hcategory ? $this->content_model->_hcategory_member_post_code() : dr_member_auth($this->member_authid, $this->member_cache['auth_module'][SITE_ID][$this->module['dirname']]['category'][$this->is_get_catid]['code']); return $data; } $row = $this->content_model->get_data($id); if (!$row) { return []; } elseif ($this->uid != $row['uid']) { return []; } // 判斷是同步欄目數(shù)據(jù) if ($row['link_id'] > 0) { $row = $this->content_model->get_data($row['link_id']); if (!$row) { return []; } $this->replace_id = $id = $row['id']; } !$this->is_get_catid && $this->is_get_catid = (int)$row['catid']; // 欄目驗(yàn)證碼 $this->is_post_code = $this->is_hcategory ? $this->content_model->_hcategory_member_post_code() : dr_member_auth($this->member_authid, $this->member_cache['auth_module'][SITE_ID][$this->module['dirname']]['category'][$this->is_get_catid]['code']); // 更新時(shí)間 $row['updatetime'] = $row['inputtime']; //var_dump($row); return $row; }
// 格式化保存數(shù)據(jù) protected function _Format_Data($id, $data, $old) { $data = parent::_Format_Data($id, $data, $old); $old && $data[1]['updatetime'] = $old['updatetime']; // 更新時(shí)間賦值老數(shù)據(jù) return $data; }
回復(fù)@官方實(shí)習(xí)技術(shù)
寫在這里?
這個(gè)
$old['updatetime']
應(yīng)該是不行的,好像在格式化之前已經(jīng)操作了復(fù)制系統(tǒng)時(shí)間!
不過我是要調(diào)整到 inputtime, 所以用
$old['inputtime']
這個(gè)就沒錯(cuò)誤!
_Format_Data繼承函數(shù)寫在控制器里面就行了
看不懂 啊
用這個(gè)方法
參考文檔:《用戶中心模塊控制器繼承重寫》
開源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!
回復(fù)迅睿框架創(chuàng)始人
我在這個(gè)文件里寫了 _Data
但是…… 好像提交過去,他依舊是走到 \dayrui\App\模塊\Models\Content.php
而且,因?yàn)槭蔷庉?,好像?huì)員中心提交的內(nèi)容,不參與 inputtime字段修改!
我打印出來沒有inputtime 字段,但是我 在會(huì)員中心都模板里已經(jīng)加了
<input name="inputtime" type="hidden" value="{$inputtime}">
上面這個(gè)文件打印出來是有inputtime
他接著要繼續(xù)走到 \dayrui\App\模塊\Models\Content.php
這里打印出來就丟失了 inputtime
/** * 獲取內(nèi)容 * $id 內(nèi)容id,新增為0 * */ protected function _Data($id = 0) { // 判斷是否來至審核 if (defined('IS_MODULE_VERIFY')) { $row = \Phpcmf\Service::M()->table(SITE_ID.'_'.$this->module['dirname'].'_verify')->get($id); if (!$row) { return []; } elseif ($this->uid != $row['uid']) { return []; } $data = dr_string2array($row['content']); $data['backinfo'] = dr_string2array($row['backinfo']); !$this->is_get_catid && $this->is_get_catid = (int)$row['catid']; // 欄目驗(yàn)證碼 $this->is_post_code = $this->is_hcategory ? $this->content_model->_hcategory_member_post_code() : dr_member_auth($this->member_authid, $this->member_cache['auth_module'][SITE_ID][$this->module['dirname']]['category'][$this->is_get_catid]['code']); return $data; } $row = $this->content_model->get_data($id); if (!$row) { return []; } elseif ($this->uid != $row['uid']) { return []; } // 判斷是同步欄目數(shù)據(jù) if ($row['link_id'] > 0) { $row = $this->content_model->get_data($row['link_id']); if (!$row) { return []; } $this->replace_id = $id = $row['id']; } !$this->is_get_catid && $this->is_get_catid = (int)$row['catid']; // 欄目驗(yàn)證碼 $this->is_post_code = $this->is_hcategory ? $this->content_model->_hcategory_member_post_code() : dr_member_auth($this->member_authid, $this->member_cache['auth_module'][SITE_ID][$this->module['dirname']]['category'][$this->is_get_catid]['code']); // 更新時(shí)間 $row['updatetime'] = $row['inputtime']; //var_dump($row); return $row; }// 格式化保存數(shù)據(jù) protected function _Format_Data($id, $data, $old) { $data = parent::_Format_Data($id, $data, $old); $old && $data[1]['updatetime'] = $old['updatetime']; // 更新時(shí)間賦值老數(shù)據(jù) return $data; }開源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!
回復(fù)@官方實(shí)習(xí)技術(shù)
寫在這里?
回復(fù)@官方實(shí)習(xí)技術(shù)
這個(gè)
應(yīng)該是不行的,好像在格式化之前已經(jīng)操作了復(fù)制系統(tǒng)時(shí)間!
不過我是要調(diào)整到 inputtime, 所以用
這個(gè)就沒錯(cuò)誤!
_Format_Data繼承函數(shù)寫在控制器里面就行了
看不懂 啊