作者 lyh

gx

... ... @@ -66,7 +66,6 @@ class ReplaceHtmlLogic extends BaseLogic
* @time :2024/5/7 15:52
*/
public function replaceTemplateMainHtml(){
$data = $this->sourceTypeInfo();
$typeInfo = $data[$this->param['name']];
if(!isset($typeInfo)){
... ... @@ -76,15 +75,16 @@ class ReplaceHtmlLogic extends BaseLogic
//查询当前类型所有装修的记录
ProjectServer::useProject($this->param['project_id']);
$bTemplateModel = new BTemplate();
$condition = ['source'=>$typeInfo['source'],'is_custom'=>$typeInfo['is_custom'],'is_list'=>$typeInfo['is_list'], 'template_id'=>$template_id];
$condition = ['source'=>$typeInfo['source'],'is_custom'=>$typeInfo['is_custom'],
'is_list'=>$typeInfo['is_list'], 'template_id'=>$template_id,'main_html'=>['like','%'.$this->param['old_html'].'%']];
$list = $bTemplateModel->list($condition);
DB::disconnect('custom_mysql');
//TODO::生成一条任务记录
$total_num = count($list);
$replaceId = $this->saveReplaceHtml($this->param,$typeInfo,$template_id,$total_num);
foreach ($list as $v){
foreach ($list as $value){
//生成子任务
$this->saveReplaceHtmlLog($replaceId,$v);
$this->saveReplaceHtmlLog($replaceId,$value);
}
return $this->success();
}
... ... @@ -102,7 +102,7 @@ class ReplaceHtmlLogic extends BaseLogic
'is_custom'=>$typeInfo['is_custom'],
'is_list'=>$typeInfo['is_list'],
'template_id'=>$template_id,
'status'=>BTemplate::STATUS,
'status'=>$this->model::STATUS,
'old_html'=>$param['old_html'],
'html'=>$param['html'],
'project_id'=>$param['project_id'],
... ... @@ -118,11 +118,19 @@ class ReplaceHtmlLogic extends BaseLogic
* @method :post
* @time :2024/5/8 9:37
*/
public function saveReplaceHtmlLog($replace_id,$replace_template_id,$typeInfo){
public function saveReplaceHtmlLog($param,$replace_id,$data){
$logData = [
'replace_id'=>$replace_id,
'source'=>$replace_template_id,
'source'=>$data['source'],
'source_id'=>$data['source_id'],
'is_list'=>$data['is_list'],
'is_custom'=>$data['is_custom'],
'project_id'=>$data['project_id'],
'uid'=>$this->user['manager_id'],
'status'=>$this->model::STATUS,
'old_html'=>$param['old_html'],
'html'=>$param['html'],
'template_id'=>$data['template_id']
];
$replaceHtmlModel = new TemplateReplaceHtmlLog();
$save_id = $replaceHtmlModel->addReturnId($logData);
... ...
... ... @@ -114,8 +114,8 @@ class CategoryLogic extends BaseLogic
* @time :2023/8/21 17:14
*/
public function categorySave(){
DB::beginTransaction();
try {
// DB::beginTransaction();
// try {
$this->param = $this->saveHandleParam($this->param);
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
... ... @@ -130,11 +130,11 @@ class CategoryLogic extends BaseLogic
}
//清除缓存
Common::del_user_cache('product_category',$this->user['project_id']);
DB::commit();
} catch (\Exception $e){
DB::rollBack();
$this->fail('系统错误,请联系管理员');
}
// DB::commit();
// } catch (\Exception $e){
// DB::rollBack();
// $this->fail('系统错误,请联系管理员');
// }
$this->addUpdateNotify(RouteMap::SOURCE_PRODUCT_CATE,$route);
$this->curlDelRoute(['new_route'=>$route]);
return $this->success(['id'=>$id]);
... ...
... ... @@ -14,6 +14,10 @@ use App\Models\Base;
class TemplateReplaceHtml extends Base
{
protected $table = 'gl_replace_html';
const STATUS = 0;
const STATUS_SUCCESS = 1;
const STATUS_ERROR = 2;
/**
* @remark :默认类型
* @name :sourceType
... ...