作者 赵彬吉
... ... @@ -99,7 +99,7 @@ class SendProduct extends Command
$start_date = date('Y-m-d H:i:s');
$end_date = date('Y-m-d 23:59:59');
$blogModel = new Blog();
$arr = $blogModel->formatQuery(['send_time'=>['between',[$start_date,$end_date]],'status'=>3])->pluck('url');
$arr = $blogModel->formatQuery(['release_at'=>['between',[$start_date,$end_date]],'status'=>3])->pluck('url');
$blogModel->edit(['status'=>1],['release_at'=>['between',[$start_date,$end_date]],'status'=>3]);
return $arr;
}
... ... @@ -115,7 +115,7 @@ class SendProduct extends Command
$start_date = date('Y-m-d H:i:s');
$end_date = date('Y-m-d 23:59:59');
$newsModel = new News();
$arr = $newsModel->formatQuery(['send_time'=>['between',[$start_date,$end_date]],'status'=>3])->pluck('url');
$arr = $newsModel->formatQuery(['release_at'=>['between',[$start_date,$end_date]],'status'=>3])->pluck('url');
$newsModel->edit(['status'=>1],['release_at'=>['between',[$start_date,$end_date]],'status'=>3]);
return $arr;
}
... ...
... ... @@ -956,10 +956,10 @@ class ProjectUpdate extends Command
foreach ($items as $item) {
$route = $this->get_url_route($item['url'] ?? '');
if ($route) {
$item['name'] = $this->special2str($item['name'] ?? '');
try {
$cate = $model->read(['route' => $route], 'id');
if (!$cate) {
try {
$item['name'] = $this->special2str($item['name'] ?? '');
$cate_id = $model->addReturnId([
'project_id' => $project_id,
'module_id' => $module_id,
... ... @@ -968,6 +968,12 @@ class ProjectUpdate extends Command
'route' => $route
]);
$this->set_map($route, RouteMap::SOURCE_MODULE_CATE, $cate_id, $project_id);
} else {
$model->edit([
'name' => $item['name'],
'original_id' => $item['id'],
], ['id' => $cate['id']]);
}
} catch (\Exception $e) {
echo 'date:' . date('Y-m-d H:i:s') . ', category_custom_insert error: ' . $e->getMessage() . PHP_EOL;
continue;
... ... @@ -975,7 +981,6 @@ class ProjectUpdate extends Command
}
}
}
}
//特殊字符转换
protected function special2str($str)
... ...
... ... @@ -73,8 +73,12 @@ class BlogController extends BaseController
$query = $query->where('operator_id',$this->map['operator_id']);
}
if(isset($this->map['status'])){
if($this->map['status'] == 0){
$query = $query->whereIn('status',[0,3]);
}else{
$query = $query->where('status',$this->map['status']);
}
}
if(isset($this->map['name']) && !empty($this->map['name'])){
$query = $query->where('name',$this->map['name'][0],'%'.$this->map['name'][1].'%');
}
... ...
... ... @@ -77,8 +77,12 @@ class NewsController extends BaseController
$query = $query->where('operator_id',$this->map['operator_id']);
}
if(isset($this->map['status'])){
if($this->map['status'] == 0){
$query = $query->whereIn('status',[0,3]);
}else{
$query = $query->where('status',$this->map['status']);
}
}
if(isset($this->map['name']) && !empty($this->map['name'])){
$query = $query->where('name',$this->map['name'][0],'%'.$this->map['name'][1].'%');
}
... ...
... ... @@ -84,13 +84,14 @@ class Product extends Base
const STATUS_DRAFT = 0;
const STATUS_ON = 1;
const STATUS_RECYCLE = 2;
const STATUS_THREE = 3;
public static function statusMap(){
return [
self::STATUS_DRAFT => '草稿',
self::STATUS_ON => '已发布',
self::STATUS_RECYCLE => '回收站',
self::STATUS_THREE => '待发布',
];
}
... ...