作者 赵彬吉
@@ -99,7 +99,7 @@ class SendProduct extends Command @@ -99,7 +99,7 @@ class SendProduct extends Command
99 $start_date = date('Y-m-d H:i:s'); 99 $start_date = date('Y-m-d H:i:s');
100 $end_date = date('Y-m-d 23:59:59'); 100 $end_date = date('Y-m-d 23:59:59');
101 $blogModel = new Blog(); 101 $blogModel = new Blog();
102 - $arr = $blogModel->formatQuery(['send_time'=>['between',[$start_date,$end_date]],'status'=>3])->pluck('url'); 102 + $arr = $blogModel->formatQuery(['release_at'=>['between',[$start_date,$end_date]],'status'=>3])->pluck('url');
103 $blogModel->edit(['status'=>1],['release_at'=>['between',[$start_date,$end_date]],'status'=>3]); 103 $blogModel->edit(['status'=>1],['release_at'=>['between',[$start_date,$end_date]],'status'=>3]);
104 return $arr; 104 return $arr;
105 } 105 }
@@ -115,7 +115,7 @@ class SendProduct extends Command @@ -115,7 +115,7 @@ class SendProduct extends Command
115 $start_date = date('Y-m-d H:i:s'); 115 $start_date = date('Y-m-d H:i:s');
116 $end_date = date('Y-m-d 23:59:59'); 116 $end_date = date('Y-m-d 23:59:59');
117 $newsModel = new News(); 117 $newsModel = new News();
118 - $arr = $newsModel->formatQuery(['send_time'=>['between',[$start_date,$end_date]],'status'=>3])->pluck('url'); 118 + $arr = $newsModel->formatQuery(['release_at'=>['between',[$start_date,$end_date]],'status'=>3])->pluck('url');
119 $newsModel->edit(['status'=>1],['release_at'=>['between',[$start_date,$end_date]],'status'=>3]); 119 $newsModel->edit(['status'=>1],['release_at'=>['between',[$start_date,$end_date]],'status'=>3]);
120 return $arr; 120 return $arr;
121 } 121 }
@@ -956,10 +956,10 @@ class ProjectUpdate extends Command @@ -956,10 +956,10 @@ class ProjectUpdate extends Command
956 foreach ($items as $item) { 956 foreach ($items as $item) {
957 $route = $this->get_url_route($item['url'] ?? ''); 957 $route = $this->get_url_route($item['url'] ?? '');
958 if ($route) { 958 if ($route) {
  959 + $item['name'] = $this->special2str($item['name'] ?? '');
  960 + try {
959 $cate = $model->read(['route' => $route], 'id'); 961 $cate = $model->read(['route' => $route], 'id');
960 if (!$cate) { 962 if (!$cate) {
961 - try {  
962 - $item['name'] = $this->special2str($item['name'] ?? '');  
963 $cate_id = $model->addReturnId([ 963 $cate_id = $model->addReturnId([
964 'project_id' => $project_id, 964 'project_id' => $project_id,
965 'module_id' => $module_id, 965 'module_id' => $module_id,
@@ -968,6 +968,12 @@ class ProjectUpdate extends Command @@ -968,6 +968,12 @@ class ProjectUpdate extends Command
968 'route' => $route 968 'route' => $route
969 ]); 969 ]);
970 $this->set_map($route, RouteMap::SOURCE_MODULE_CATE, $cate_id, $project_id); 970 $this->set_map($route, RouteMap::SOURCE_MODULE_CATE, $cate_id, $project_id);
  971 + } else {
  972 + $model->edit([
  973 + 'name' => $item['name'],
  974 + 'original_id' => $item['id'],
  975 + ], ['id' => $cate['id']]);
  976 + }
971 } catch (\Exception $e) { 977 } catch (\Exception $e) {
972 echo 'date:' . date('Y-m-d H:i:s') . ', category_custom_insert error: ' . $e->getMessage() . PHP_EOL; 978 echo 'date:' . date('Y-m-d H:i:s') . ', category_custom_insert error: ' . $e->getMessage() . PHP_EOL;
973 continue; 979 continue;
@@ -975,7 +981,6 @@ class ProjectUpdate extends Command @@ -975,7 +981,6 @@ class ProjectUpdate extends Command
975 } 981 }
976 } 982 }
977 } 983 }
978 - }  
979 984
980 //特殊字符转换 985 //特殊字符转换
981 protected function special2str($str) 986 protected function special2str($str)
@@ -73,8 +73,12 @@ class BlogController extends BaseController @@ -73,8 +73,12 @@ class BlogController extends BaseController
73 $query = $query->where('operator_id',$this->map['operator_id']); 73 $query = $query->where('operator_id',$this->map['operator_id']);
74 } 74 }
75 if(isset($this->map['status'])){ 75 if(isset($this->map['status'])){
  76 + if($this->map['status'] == 0){
  77 + $query = $query->whereIn('status',[0,3]);
  78 + }else{
76 $query = $query->where('status',$this->map['status']); 79 $query = $query->where('status',$this->map['status']);
77 } 80 }
  81 + }
78 if(isset($this->map['name']) && !empty($this->map['name'])){ 82 if(isset($this->map['name']) && !empty($this->map['name'])){
79 $query = $query->where('name',$this->map['name'][0],'%'.$this->map['name'][1].'%'); 83 $query = $query->where('name',$this->map['name'][0],'%'.$this->map['name'][1].'%');
80 } 84 }
@@ -77,8 +77,12 @@ class NewsController extends BaseController @@ -77,8 +77,12 @@ class NewsController extends BaseController
77 $query = $query->where('operator_id',$this->map['operator_id']); 77 $query = $query->where('operator_id',$this->map['operator_id']);
78 } 78 }
79 if(isset($this->map['status'])){ 79 if(isset($this->map['status'])){
  80 + if($this->map['status'] == 0){
  81 + $query = $query->whereIn('status',[0,3]);
  82 + }else{
80 $query = $query->where('status',$this->map['status']); 83 $query = $query->where('status',$this->map['status']);
81 } 84 }
  85 + }
82 if(isset($this->map['name']) && !empty($this->map['name'])){ 86 if(isset($this->map['name']) && !empty($this->map['name'])){
83 $query = $query->where('name',$this->map['name'][0],'%'.$this->map['name'][1].'%'); 87 $query = $query->where('name',$this->map['name'][0],'%'.$this->map['name'][1].'%');
84 } 88 }
@@ -84,13 +84,14 @@ class Product extends Base @@ -84,13 +84,14 @@ class Product extends Base
84 const STATUS_DRAFT = 0; 84 const STATUS_DRAFT = 0;
85 const STATUS_ON = 1; 85 const STATUS_ON = 1;
86 const STATUS_RECYCLE = 2; 86 const STATUS_RECYCLE = 2;
87 - 87 + const STATUS_THREE = 3;
88 88
89 public static function statusMap(){ 89 public static function statusMap(){
90 return [ 90 return [
91 self::STATUS_DRAFT => '草稿', 91 self::STATUS_DRAFT => '草稿',
92 self::STATUS_ON => '已发布', 92 self::STATUS_ON => '已发布',
93 self::STATUS_RECYCLE => '回收站', 93 self::STATUS_RECYCLE => '回收站',
  94 + self::STATUS_THREE => '待发布',
94 ]; 95 ];
95 } 96 }
96 97