作者 赵彬吉
@@ -292,7 +292,7 @@ class ProjectController extends BaseController @@ -292,7 +292,7 @@ class ProjectController extends BaseController
292 $domainModel = new DomainInfo(); 292 $domainModel = new DomainInfo();
293 $item['domain'] = !empty($item['domain']) ? $domainModel->getDomain($item['domain']) : ''; 293 $item['domain'] = !empty($item['domain']) ? $domainModel->getDomain($item['domain']) : '';
294 $item['product_num'] = $data['product'] ?? 0; 294 $item['product_num'] = $data['product'] ?? 0;
295 - $item['keyword_num'] = $item['key'] ?? 0; 295 + $item['keyword_num'] = $data['key'] ?? 0;
296 $item['autologin_code'] = getAutoLoginCode($item['id']); 296 $item['autologin_code'] = getAutoLoginCode($item['id']);
297 $item['article_num'] = ($data['blog'] ?? 0) + ($data['news'] ?? 0); 297 $item['article_num'] = ($data['blog'] ?? 0) + ($data['news'] ?? 0);
298 $item['task_finish_num'] = Task::getNumByProjectId($item['id'], Task::STATUS_DOWN); 298 $item['task_finish_num'] = Task::getNumByProjectId($item['id'], Task::STATUS_DOWN);
@@ -758,6 +758,9 @@ class ProjectController extends BaseController @@ -758,6 +758,9 @@ class ProjectController extends BaseController
758 * @time :2023/11/8 14:17 758 * @time :2023/11/8 14:17
759 */ 759 */
760 public function copyProject(ProjectLogic $logic){ 760 public function copyProject(ProjectLogic $logic){
  761 + if($this->manage['mobile'] != '15680871314' || $this->manage['mobile'] != '18008059100'){
  762 + $this->response('当前账号不支持复制项目');
  763 + }
761 $this->request->validate([ 764 $this->request->validate([
762 'project_id'=>'required', 765 'project_id'=>'required',
763 ],[ 766 ],[
@@ -75,6 +75,9 @@ class ProjectLogic extends BaseLogic @@ -75,6 +75,9 @@ class ProjectLogic extends BaseLogic
75 if(empty($info['channel'])){ 75 if(empty($info['channel'])){
76 $info['channel'] = ["user_id"=>"", "zone_id"=>"", "channel_id"=>""]; 76 $info['channel'] = ["user_id"=>"", "zone_id"=>"", "channel_id"=>""];
77 } 77 }
  78 + if(empty($info['payment']['renewal_record'])){
  79 + $info['payment']['renewal_record'] = [["amount"=> null, "remark"=> null, "expire_at"=> null]];
  80 + }
78 return $this->success($info); 81 return $this->success($info);
79 } 82 }
80 83
@@ -533,9 +536,12 @@ class ProjectLogic extends BaseLogic @@ -533,9 +536,12 @@ class ProjectLogic extends BaseLogic
533 * @time :2023/11/8 14:23 536 * @time :2023/11/8 14:23
534 */ 537 */
535 public function copyProject(){ 538 public function copyProject(){
  539 + DB::beginTransaction();
  540 + try {
536 //复制初始项目 541 //复制初始项目
537 $data = $this->model::where('id', $this->param['project_id'])->first(); 542 $data = $this->model::where('id', $this->param['project_id'])->first();
538 $data = $data->getAttributes(); 543 $data = $data->getAttributes();
  544 + $type = $data['type'];
539 $data['type'] = 0; 545 $data['type'] = 0;
540 $data['title'] = $data['title'].'-copy'; 546 $data['title'] = $data['title'].'-copy';
541 unset($data['id']); 547 unset($data['id']);
@@ -597,7 +603,14 @@ class ProjectLogic extends BaseLogic @@ -597,7 +603,14 @@ class ProjectLogic extends BaseLogic
597 $settingData['project_id'] = $project_id; 603 $settingData['project_id'] = $project_id;
598 $settingTemplateModel->insert($settingData); 604 $settingTemplateModel->insert($settingData);
599 } 605 }
  606 + DB::commit();
  607 + }catch (\Exception $e){
  608 + DB::rollBack();
  609 + $this->fail('error');
  610 + }
  611 + if($type != 0){
600 $this->copyMysql($this->param['project_id'],$project_id); 612 $this->copyMysql($this->param['project_id'],$project_id);
  613 + }
601 return $this->success($data); 614 return $this->success($data);
602 } 615 }
603 616
@@ -29,15 +29,11 @@ class UserLogic extends BaseLogic @@ -29,15 +29,11 @@ class UserLogic extends BaseLogic
29 */ 29 */
30 public function user_info() 30 public function user_info()
31 { 31 {
32 - $info = Common::get_user_cache($this->model, $this->param['id'], 'A');  
33 - if (empty($info)) {  
34 $info = $this->model->read($this->param, ['id', 'project_id', 'name', 'status', 'role_id' ,'mobile', 'operator_id']); 32 $info = $this->model->read($this->param, ['id', 'project_id', 'name', 'status', 'role_id' ,'mobile', 'operator_id']);
35 if ($info === false) { 33 if ($info === false) {
36 $this->fail('当前数据不存在'); 34 $this->fail('当前数据不存在');
37 } 35 }
38 $info['project_name'] = (new Project())->read(['id' => $info['project_id']], ['title'])['title']; 36 $info['project_name'] = (new Project())->read(['id' => $info['project_id']], ['title'])['title'];
39 - Common::set_user_cache($info, $this->model, $this->param['id'], 'A');  
40 - }  
41 return $this->success($info); 37 return $this->success($info);
42 } 38 }
43 39
@@ -59,6 +59,7 @@ class KeywordLogic extends BaseLogic @@ -59,6 +59,7 @@ class KeywordLogic extends BaseLogic
59 }else{ 59 }else{
60 $this->param['project_id'] = $this->user['project_id']; 60 $this->param['project_id'] = $this->user['project_id'];
61 $this->param['created_at'] = date('Y-m-d H:i:s'); 61 $this->param['created_at'] = date('Y-m-d H:i:s');
  62 + $this->param['title'] = $this->param['title'].'-tag';
62 $this->param['updated_at'] = $this->param['created_at']; 63 $this->param['updated_at'] = $this->param['created_at'];
63 $id = $this->model->insertGetId($this->param); 64 $id = $this->model->insertGetId($this->param);
64 //路由映射 65 //路由映射
@@ -36,8 +36,10 @@ class APublicModel extends Base @@ -36,8 +36,10 @@ class APublicModel extends Base
36 ->where('project_id', $project_id)->where('status', self::STATUS_ON)->count(); 36 ->where('project_id', $project_id)->where('status', self::STATUS_ON)->count();
37 $newsNumber = DB::connection('custom_mysql')->table('gl_news') 37 $newsNumber = DB::connection('custom_mysql')->table('gl_news')
38 ->where('project_id', $project_id)->where('status', self::STATUS_ON)->count(); 38 ->where('project_id', $project_id)->where('status', self::STATUS_ON)->count();
  39 + $keyNumber = DB::connection('custom_mysql')->table('gl_product_keyword')
  40 + ->where('project_id', $project_id)->where('status', self::STATUS_ON)->count();
39 DB::disconnect('custom_mysql'); 41 DB::disconnect('custom_mysql');
40 - return ['product'=>$productNumber,'blog'=>$blogNumber,'news'=>$newsNumber]; 42 + return ['product'=>$productNumber,'blog'=>$blogNumber,'news'=>$newsNumber,'key'=>$keyNumber];
41 } 43 }
42 44
43 } 45 }