|
|
@@ -2324,14 +2324,38 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
// 分别更新 WebsiteTemplateInfo 和 WebsiteTemplate 表
|
|
|
Db::beginTransaction();
|
|
|
try {
|
|
|
- $reuslt['template_info'] = WebsiteTemplateInfo::where('website_id', $data['website_id'])
|
|
|
- ->update(['template_id' => $data['template_id'],'action_id' => 2,'user_id'=> $data['user_id']]);
|
|
|
- if(empty($reuslt['template_info'])){
|
|
|
+ if($data['template_id'] != $website_template_info['template_id']){
|
|
|
+ $info_data = [
|
|
|
+ 'template_id' => $data['template_id'],
|
|
|
+ 'action_id' => 2,
|
|
|
+ 'user_id'=> $data['user_id']
|
|
|
+ ];
|
|
|
+ $template = [
|
|
|
+ 'template_id' => $data['template_id'],
|
|
|
+ 'user_id'=> $data['user_id'],
|
|
|
+ 'template_data' => null,
|
|
|
+ 'canvas_data' => null
|
|
|
+ ];
|
|
|
+ }else{
|
|
|
+ $info_data = [
|
|
|
+ 'template_id' => $data['template_id'],
|
|
|
+ 'status' => 0,
|
|
|
+ 'action_id' => 2,
|
|
|
+ 'user_id'=> $data['user_id']
|
|
|
+ ];
|
|
|
+ $template = [
|
|
|
+ 'template_id' => $data['template_id'],
|
|
|
+ 'user_id'=> $data['user_id']
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ $result['template_info'] = WebsiteTemplateInfo::where('website_id', $data['website_id'])
|
|
|
+ ->update($info_data);
|
|
|
+ if(empty($result['template_info'])){
|
|
|
Db::rollBack();
|
|
|
return Result::error('选择皮肤失败!');
|
|
|
}
|
|
|
$result['template'] = WebsiteTemplate::where('website_id', $data['website_id'])
|
|
|
- ->update(['template_id' => $data['template_id'],'user_id'=> $data['user_id']]);
|
|
|
+ ->update($template);
|
|
|
if(empty($result['template'])){
|
|
|
Db::rollBack();
|
|
|
return Result::error('网站模版选择皮肤失败!');
|