作者 lyh

gx

@@ -66,7 +66,6 @@ class ReplaceHtmlLogic extends BaseLogic @@ -66,7 +66,6 @@ class ReplaceHtmlLogic extends BaseLogic
66 * @time :2024/5/7 15:52 66 * @time :2024/5/7 15:52
67 */ 67 */
68 public function replaceTemplateMainHtml(){ 68 public function replaceTemplateMainHtml(){
69 -  
70 $data = $this->sourceTypeInfo(); 69 $data = $this->sourceTypeInfo();
71 $typeInfo = $data[$this->param['name']]; 70 $typeInfo = $data[$this->param['name']];
72 if(!isset($typeInfo)){ 71 if(!isset($typeInfo)){
@@ -76,15 +75,16 @@ class ReplaceHtmlLogic extends BaseLogic @@ -76,15 +75,16 @@ class ReplaceHtmlLogic extends BaseLogic
76 //查询当前类型所有装修的记录 75 //查询当前类型所有装修的记录
77 ProjectServer::useProject($this->param['project_id']); 76 ProjectServer::useProject($this->param['project_id']);
78 $bTemplateModel = new BTemplate(); 77 $bTemplateModel = new BTemplate();
79 - $condition = ['source'=>$typeInfo['source'],'is_custom'=>$typeInfo['is_custom'],'is_list'=>$typeInfo['is_list'], 'template_id'=>$template_id]; 78 + $condition = ['source'=>$typeInfo['source'],'is_custom'=>$typeInfo['is_custom'],
  79 + 'is_list'=>$typeInfo['is_list'], 'template_id'=>$template_id,'main_html'=>['like','%'.$this->param['old_html'].'%']];
80 $list = $bTemplateModel->list($condition); 80 $list = $bTemplateModel->list($condition);
81 DB::disconnect('custom_mysql'); 81 DB::disconnect('custom_mysql');
82 //TODO::生成一条任务记录 82 //TODO::生成一条任务记录
83 $total_num = count($list); 83 $total_num = count($list);
84 $replaceId = $this->saveReplaceHtml($this->param,$typeInfo,$template_id,$total_num); 84 $replaceId = $this->saveReplaceHtml($this->param,$typeInfo,$template_id,$total_num);
85 - foreach ($list as $v){ 85 + foreach ($list as $value){
86 //生成子任务 86 //生成子任务
87 - $this->saveReplaceHtmlLog($replaceId,$v); 87 + $this->saveReplaceHtmlLog($replaceId,$value);
88 } 88 }
89 return $this->success(); 89 return $this->success();
90 } 90 }
@@ -102,7 +102,7 @@ class ReplaceHtmlLogic extends BaseLogic @@ -102,7 +102,7 @@ class ReplaceHtmlLogic extends BaseLogic
102 'is_custom'=>$typeInfo['is_custom'], 102 'is_custom'=>$typeInfo['is_custom'],
103 'is_list'=>$typeInfo['is_list'], 103 'is_list'=>$typeInfo['is_list'],
104 'template_id'=>$template_id, 104 'template_id'=>$template_id,
105 - 'status'=>BTemplate::STATUS, 105 + 'status'=>$this->model::STATUS,
106 'old_html'=>$param['old_html'], 106 'old_html'=>$param['old_html'],
107 'html'=>$param['html'], 107 'html'=>$param['html'],
108 'project_id'=>$param['project_id'], 108 'project_id'=>$param['project_id'],
@@ -118,11 +118,19 @@ class ReplaceHtmlLogic extends BaseLogic @@ -118,11 +118,19 @@ class ReplaceHtmlLogic extends BaseLogic
118 * @method :post 118 * @method :post
119 * @time :2024/5/8 9:37 119 * @time :2024/5/8 9:37
120 */ 120 */
121 - public function saveReplaceHtmlLog($replace_id,$replace_template_id,$typeInfo){ 121 + public function saveReplaceHtmlLog($param,$replace_id,$data){
122 $logData = [ 122 $logData = [
123 'replace_id'=>$replace_id, 123 'replace_id'=>$replace_id,
124 - 'source'=>$replace_template_id, 124 + 'source'=>$data['source'],
  125 + 'source_id'=>$data['source_id'],
  126 + 'is_list'=>$data['is_list'],
  127 + 'is_custom'=>$data['is_custom'],
  128 + 'project_id'=>$data['project_id'],
125 'uid'=>$this->user['manager_id'], 129 'uid'=>$this->user['manager_id'],
  130 + 'status'=>$this->model::STATUS,
  131 + 'old_html'=>$param['old_html'],
  132 + 'html'=>$param['html'],
  133 + 'template_id'=>$data['template_id']
126 ]; 134 ];
127 $replaceHtmlModel = new TemplateReplaceHtmlLog(); 135 $replaceHtmlModel = new TemplateReplaceHtmlLog();
128 $save_id = $replaceHtmlModel->addReturnId($logData); 136 $save_id = $replaceHtmlModel->addReturnId($logData);
@@ -114,8 +114,8 @@ class CategoryLogic extends BaseLogic @@ -114,8 +114,8 @@ class CategoryLogic extends BaseLogic
114 * @time :2023/8/21 17:14 114 * @time :2023/8/21 17:14
115 */ 115 */
116 public function categorySave(){ 116 public function categorySave(){
117 - DB::beginTransaction();  
118 - try { 117 +// DB::beginTransaction();
  118 +// try {
119 $this->param = $this->saveHandleParam($this->param); 119 $this->param = $this->saveHandleParam($this->param);
120 if(isset($this->param['id']) && !empty($this->param['id'])){ 120 if(isset($this->param['id']) && !empty($this->param['id'])){
121 $id = $this->param['id']; 121 $id = $this->param['id'];
@@ -130,11 +130,11 @@ class CategoryLogic extends BaseLogic @@ -130,11 +130,11 @@ class CategoryLogic extends BaseLogic
130 } 130 }
131 //清除缓存 131 //清除缓存
132 Common::del_user_cache('product_category',$this->user['project_id']); 132 Common::del_user_cache('product_category',$this->user['project_id']);
133 - DB::commit();  
134 - } catch (\Exception $e){  
135 - DB::rollBack();  
136 - $this->fail('系统错误,请联系管理员');  
137 - } 133 +// DB::commit();
  134 +// } catch (\Exception $e){
  135 +// DB::rollBack();
  136 +// $this->fail('系统错误,请联系管理员');
  137 +// }
138 $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT_CATE,$route); 138 $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT_CATE,$route);
139 $this->curlDelRoute(['new_route'=>$route]); 139 $this->curlDelRoute(['new_route'=>$route]);
140 return $this->success(['id'=>$id]); 140 return $this->success(['id'=>$id]);
@@ -14,6 +14,10 @@ use App\Models\Base; @@ -14,6 +14,10 @@ use App\Models\Base;
14 class TemplateReplaceHtml extends Base 14 class TemplateReplaceHtml extends Base
15 { 15 {
16 protected $table = 'gl_replace_html'; 16 protected $table = 'gl_replace_html';
  17 +
  18 + const STATUS = 0;
  19 + const STATUS_SUCCESS = 1;
  20 + const STATUS_ERROR = 2;
17 /** 21 /**
18 * @remark :默认类型 22 * @remark :默认类型
19 * @name :sourceType 23 * @name :sourceType