作者 lyh

gx

... ... @@ -81,6 +81,8 @@ class AyrShareController extends BaseController
*/
public function create_account(AyrShareRequest $ayrShareRequest,AyrShareLogic $ayrShareLogic){
$ayrShareRequest->validated();
//验证参数及
$ayrShareLogic->AyrVerify();
$param = [
'title'=>self::TITLE . ':' . $this->user['project_id'] . '-' . $this->param['name'],
];
... ...
... ... @@ -41,6 +41,27 @@ class AyrShareLogic extends BaseLogic
}
/**
* @name :AyrVerify(验证参数)
* @author :lyh
* @method :post
* @time :2023/6/7 11:52
*/
public function AyrVerify(){
if(isset($this->param['id'])){
$info = $this->model->read(['name'=>$this->param['name'],'id'=>['!=',$this->param['id']]]);
if($info !== false){
$this->fail('当前名称已存在');
}
}else{
$count = $this->model->where(['project_id'=>$this->user['project_id']])->count();
if($count > $this->model::COUNT){
$this->fail('当前账户只允许添加3个账号');
}
}
return $this->success();
}
/**
* @name :(创建账号并绑定写入数据库)ayr_add
* @author :lyh
* @method :post
... ... @@ -56,9 +77,8 @@ class AyrShareLogic extends BaseLogic
'project_id'=>$this->user['project_id'],
'name'=>$this->param['name'],
];
$info = $this->model->read(['name'=>$this->param['name']]);
if($info !== false){
$rs = $this->model->edit($param,['id'=>$info['id']]);
if(isset($this->param['id'])){
$rs = $this->model->edit($param,['id'=>$this->param['id']]);
}else{
$rs = $this->model->add($param);
}
... ... @@ -112,36 +132,6 @@ class AyrShareLogic extends BaseLogic
return $this->success();
}
/**
* @name :(根据hash获取图片详情)save_info_info
* @author :lyh
* @method :post
* @time :2023/5/10 15:01
*/
public function save_img_info($hash){
$imageModel = new ImageModel();
$info = $imageModel->read(['hash'=>$hash]);
if($info === false){
$this->fail('error');
}
return $this->success($info);
}
/**
* @name :(根据hash视频详情)save_info_info
* @author :lyh
* @method :post
* @time :2023/5/10 15:01
*/
public function save_file_info($hash){
$fileModel = new FileModel();
$info = $fileModel->read(['hash'=>$hash]);
if($info === false){
$this->fail('error');
}
return $this->success($info);
}
/**
* @name :(更新图片库)save_img
* @author :lyh
* @method :post
... ...
... ... @@ -23,7 +23,7 @@ class AyrShareRequest extends FormRequest
public function rules()
{
return [
'name'=>'required|unique:gl_ayr_share,name',
'name'=>'required',
];
}
... ...
... ... @@ -8,6 +8,8 @@ class AyrShare extends Base
{
protected $table = 'gl_ayr_share';
const COUNT = 3;
const TYPE_FACEBOOK = 1;
const TYPE_TWITTER = 2;
const TYPE_LINKEDIN = 3;
... ... @@ -49,4 +51,6 @@ class AyrShare extends Base
self::TYPE_PINTEREST => 1,
self::TYPE_TIKTOK => 1,
];
}
... ...