添加:优化文章相关内容

This commit is contained in:
wuhui_zzw 2023-03-06 15:32:01 +08:00
parent 54fbc09803
commit 4a43214bb4
23 changed files with 147 additions and 2 deletions

View File

@ -25,7 +25,9 @@ class Article extends NewBaseModel{
protected $append = [
'category_name'
];
protected $autoWriteTimestamp = 'int'; // 开启自动时间戳
protected $createTime = 'create_time'; // 默认添加时间字段
protected $updateTime = 'update_time'; // 默认编辑时间字段
/**
* Common: 列表获取

View File

@ -17,6 +17,9 @@ use app\model\NewBaseModel;
class ArticleCategory extends NewBaseModel{
protected $pk = 'category_id';
protected $autoWriteTimestamp = 'int'; // 开启自动时间戳
protected $createTime = 'create_time'; // 默认添加时间字段
protected $updateTime = 'update_time'; // 默认编辑时间字段
/**
* Common: 列表获取
* Author: wu-hui

View File

@ -18,6 +18,7 @@ class ArticleHistory extends NewBaseModel{
protected $pk = 'id';
//protected $autoWriteTimestamp = false; // 开启自动时间戳
protected $autoWriteTimestamp = 'int'; // 开启自动时间戳
protected $createTime = 'create_time'; // 默认添加时间字段
protected $updateTime = 'update_time'; // 默认编辑时间字段
protected $deleteTime = false; // 软删除字段

View File

@ -180,6 +180,6 @@ class Wechat extends BaseApi
$config_model = new ConfigModel();
$config_result = $config_model->getWechatConfig($this->site_id)[ 'data' ][ 'value' ];
return $this->response($this->success([ 'qrcode' => $config_result[ 'qrcode' ] ]));
return $this->response($this->success([ 'qrcode' => $config_result[ 'qrcode' ] ?? '' ]));
}
}

View File

@ -1829,4 +1829,73 @@ function decode($code)
$num += strpos($sourceString, $code[$i]) * pow(4, $i);
}
return $num;
}
/**
* Common: 下划线字符串 驼峰字符串
* Author: wu-hui
* Time: 2022/10/20 16:25
* @param $string
* @param string $separator
* @return string
*/
function camelize($string,$separator = '_'){
$string = $separator. str_replace($separator, " ", strtolower($string));
return ltrim(str_replace(" ", "", ucwords($string)), $separator );
}
/**
* Common: 根据类型获取对应的时间戳
* Author: wu-hui
* Time: 2022/11/01 17:20
* @param $type
* @return array
*/
function getTimeStamp($type){
$startTime = $endTime =0;
#year=本年,month=本月,today=今日,yesterday=昨日,last_week=上周,
switch($type){
// 本年
case "year":
$startTime = strtotime(date("Y-1-1"));
$endTime = strtotime(date("Y-1-1"). " +1 year -1 day ");
break;
// 本月
case "month":
$startTime = strtotime(date("Y-m-1"));
$endTime = strtotime(date("Y-m-1"). " +1 month -1 day ");
break;
// 今日
case "today":
$startTime = strtotime(date("Y-m-d"));
$endTime = strtotime(date("Y-m-d"). " +1 day ");
break;
// 昨日
case "yesterday":
$startTime = strtotime(date("Y-m-d"). " -1 day ");
$endTime = strtotime(date("Y-m-d"));
break;
// 上周
case "last_week":
$week = date('w') == 0 ? 7 : date('w');
$startTime = strtotime('today -' . ($week - 1) . 'day -1 week');
$endTime = strtotime('today +' . (8 - $week) . 'day -1 week');
break;
}
return [$startTime,$endTime];
}
/**
* Common: 字符串脱敏处理
* Author: wu-hui
* Time: 2022/11/03 10:48
* @param string $str 字符串内容
* @param int $front 前面保留数字字数
* @param int $after 后面保留数字字数
* @return string
*/
function desensitizationHandle($str,$front,$after){
$frontStr = mb_substr($str,0,$front);
$afterStr = mb_substr($str,-$after,$after);
return $frontStr.'***'.$afterStr;
}

View File

@ -0,0 +1,70 @@
<?php
/** ZJMall商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2022-2032 四川正今科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.zjphp.com
* 这不是自由软件!未经允许不得用于商业目或程序代码摘取及修改。
* 任何企业和个人不允许对程序代码以任何形式任何目的再发布传播。
* 唯一发布渠道官方颁发授权证书,无纸质授权凭证书视为侵权行为。
* =========================================================
*/
namespace app\shop\controller;
error_reporting(E_ALL ^ E_NOTICE);
class NewBaseShop extends BaseShop{
protected $thisDefaultModel = '';// 当前控制器默认的模型 为空则不存在
/**
* Common: 公共内容 —— 列表获取
* Author: wu-hui
* Time: 2022/10/18 14:05
*/
public function index(){
return $this->thisDefaultModel->getList($this->site_id);
}
/**
* Common: 公共内容 —— 添加/编辑信息
* Author: wu-hui
* Time: 2022/10/18 14:09
*/
public function editInfo(){
if (request()->isAjax()) {
// 参数获取
$info = input('info',[]);
$info['site_id'] = $this->site_id;
return $this->thisDefaultModel->editInfo($info);
} else {
// 获取id
$id = input('id',0);
$this->assign('id',$id);
// 获取信息
if($id > 0){
$info = $this->thisDefaultModel->singleInfo($id);
$this->assign('info',$info['data'] ?? []);
}else{
$this->assign('info',[]);
}
}
}
/**
* Common: 删除单条信息
* Author: wu-hui
* Time: 2022/10/18 14:13
*/
public function delete(){
$id = input('id', 0);
return $this->thisDefaultModel->delInfo($id);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB