12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <?php
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- namespace app\common\basics;
-
-
- use app\common\server\UrlServer;
- use think\Model;
-
-
- abstract class Models extends Model
- {
-
-
-
-
- public $_updateResult;
-
- final protected function checkResult($result) : void
- {
- $this->_updateResult = $result;
- }
-
- final function getUpdateResult() : int
- {
- return $this->_updateResult;
- }
-
-
-
- public function setImageAttr($value)
- {
- return $value ? UrlServer::setFileUrl($value) : '';
- }
-
-
-
- public function getImageAttr($value,$data)
- {
- if(!$value && isset($data['goods_snap'])){
- return UrlServer::getFileUrl($data['goods_snap']['image']);
- }
- return $value ? UrlServer::getFileUrl($value) : '';
- }
-
-
-
- function getNicknameAttr($nickname)
- {
- if (in_array(app('http')->getName(), [ 'admin', 'shop' ]) && request()->isAjax()) {
- $nickname = htmlspecialchars($nickname);
- }
-
- return $nickname;
-
- }
- }
|