作者 lms

合并分支 'lms' 到 'master'

v6优化程序 OA绑定AICC  优化程序 - success



查看合并请求 !306
... ... @@ -67,19 +67,23 @@ class ProjectAssociationController extends BaseController
$isRes = $this->ProjectAssociationLogic->normal($project_id);
// 当数据不存在时并开启状态,自动添加一条数据
if (is_null($isRes) && (!is_null($status) && $status)) {
$bool = $this->ProjectAssociationLogic->saveProject($project_id, $status);
if (empty($bool)) {
$isRes = $this->ProjectAssociationLogic->saveProject($project_id, $status);
if (is_null($isRes)) {
// 保存数据失败
$this->response('绑定AICC数据失败!', Code::SERVER_ERROR);
}
} // 关闭状态
elseif (!is_null($isRes) && (!is_null($status) && empty($status))) {
$bool = $this->ProjectAssociationLogic->closedState($isRes, $status);
if (empty($bool)) {
if ($bool) {
// 关闭aicc绑定成功
$this->response('关闭aicc绑定 - 成功!');
}else{
// 关闭aicc绑定失败
$this->response('关闭aicc绑定失败!', Code::SERVER_ERROR);
$this->response('关闭aicc绑定 - 失败!', Code::SERVER_ERROR);
}
} elseif (is_null($isRes)) {
}
if (is_null($isRes)) {
// 请开启AICC绑定
$this->response('success');
}
... ...
... ... @@ -52,7 +52,7 @@ class ProjectAssociationLogic extends Logic
* 初始化数据/修改数据
* @param int $project_id
* @param int $status
* @return bool
* @return Builder|Model|object|ProjectAssociation|null
*/
public function saveProject($project_id, $status)
{
... ... @@ -66,12 +66,12 @@ class ProjectAssociationLogic extends Logic
$isRes->user_id = (int)env('AICC_WECHAT_USER_ID');
$isRes->status = $status;
try {
$bool = $isRes->save();
$isRes->save();
DB::commit();
} catch (\Exception $exception) {
DB::rollBack();
}
return $bool;
return $isRes;
}
/**
... ...