作者 赵彬吉
... ... @@ -292,7 +292,7 @@ class ProjectController extends BaseController
$domainModel = new DomainInfo();
$item['domain'] = !empty($item['domain']) ? $domainModel->getDomain($item['domain']) : '';
$item['product_num'] = $data['product'] ?? 0;
$item['keyword_num'] = $item['key'] ?? 0;
$item['keyword_num'] = $data['key'] ?? 0;
$item['autologin_code'] = getAutoLoginCode($item['id']);
$item['article_num'] = ($data['blog'] ?? 0) + ($data['news'] ?? 0);
$item['task_finish_num'] = Task::getNumByProjectId($item['id'], Task::STATUS_DOWN);
... ... @@ -758,6 +758,9 @@ class ProjectController extends BaseController
* @time :2023/11/8 14:17
*/
public function copyProject(ProjectLogic $logic){
if($this->manage['mobile'] != '15680871314' || $this->manage['mobile'] != '18008059100'){
$this->response('当前账号不支持复制项目');
}
$this->request->validate([
'project_id'=>'required',
],[
... ...
... ... @@ -75,6 +75,9 @@ class ProjectLogic extends BaseLogic
if(empty($info['channel'])){
$info['channel'] = ["user_id"=>"", "zone_id"=>"", "channel_id"=>""];
}
if(empty($info['payment']['renewal_record'])){
$info['payment']['renewal_record'] = [["amount"=> null, "remark"=> null, "expire_at"=> null]];
}
return $this->success($info);
}
... ... @@ -533,9 +536,12 @@ class ProjectLogic extends BaseLogic
* @time :2023/11/8 14:23
*/
public function copyProject(){
DB::beginTransaction();
try {
//复制初始项目
$data = $this->model::where('id', $this->param['project_id'])->first();
$data = $data->getAttributes();
$type = $data['type'];
$data['type'] = 0;
$data['title'] = $data['title'].'-copy';
unset($data['id']);
... ... @@ -597,7 +603,14 @@ class ProjectLogic extends BaseLogic
$settingData['project_id'] = $project_id;
$settingTemplateModel->insert($settingData);
}
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('error');
}
if($type != 0){
$this->copyMysql($this->param['project_id'],$project_id);
}
return $this->success($data);
}
... ...
... ... @@ -29,15 +29,11 @@ class UserLogic extends BaseLogic
*/
public function user_info()
{
$info = Common::get_user_cache($this->model, $this->param['id'], 'A');
if (empty($info)) {
$info = $this->model->read($this->param, ['id', 'project_id', 'name', 'status', 'role_id' ,'mobile', 'operator_id']);
if ($info === false) {
$this->fail('当前数据不存在');
}
$info['project_name'] = (new Project())->read(['id' => $info['project_id']], ['title'])['title'];
Common::set_user_cache($info, $this->model, $this->param['id'], 'A');
}
return $this->success($info);
}
... ...
... ... @@ -59,6 +59,7 @@ class KeywordLogic extends BaseLogic
}else{
$this->param['project_id'] = $this->user['project_id'];
$this->param['created_at'] = date('Y-m-d H:i:s');
$this->param['title'] = $this->param['title'].'-tag';
$this->param['updated_at'] = $this->param['created_at'];
$id = $this->model->insertGetId($this->param);
//路由映射
... ...
... ... @@ -36,8 +36,10 @@ class APublicModel extends Base
->where('project_id', $project_id)->where('status', self::STATUS_ON)->count();
$newsNumber = DB::connection('custom_mysql')->table('gl_news')
->where('project_id', $project_id)->where('status', self::STATUS_ON)->count();
$keyNumber = DB::connection('custom_mysql')->table('gl_product_keyword')
->where('project_id', $project_id)->where('status', self::STATUS_ON)->count();
DB::disconnect('custom_mysql');
return ['product'=>$productNumber,'blog'=>$blogNumber,'news'=>$newsNumber];
return ['product'=>$productNumber,'blog'=>$blogNumber,'news'=>$newsNumber,'key'=>$keyNumber];
}
}
... ...