<?php
 namespace Module\Doc\Api\Controller; use Illuminate\Routing\Controller; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Input\InputPackage; use ModStart\Core\Input\Response; use ModStart\Core\Util\IdUtil; use Module\Doc\Util\DocTagUtil; use Module\Member\Auth\MemberUser; use Module\Member\Support\MemberLoginCheck; class DocTagController extends Controller implements MemberLoginCheck { public function all() { return Response::generateSuccessData(DocTagUtil::all(MemberUser::id())); } public function edit() { $input = InputPackage::buildFromInput(); $uid = $input->getTrimString('uid'); $data = []; $data['name'] = $input->getTrimString('name'); $data['color'] = $input->getTrimString('color'); if ($uid) { ModelUtil::update('doc_tag', ['memberUserId' => MemberUser::id(), 'uid' => $uid], $data); } else { $data['uid'] = IdUtil::next64BitId(); $data['memberUserId'] = MemberUser::id(); ModelUtil::insert('doc_tag', $data); } return Response::generateSuccess(); } public function delete() { $input = InputPackage::buildFromInput(); $uid = $input->getTrimString('uid'); ModelUtil::delete('doc_tag', ['memberUserId' => MemberUser::id(), 'uid' => $uid]); return Response::generateSuccess(); } }