<?php /** * Created by PhpStorm. * User: zhonglei * Date: 2017/9/1 * Time: 16:33 */ namespace Rpc\Controller\AppNotice; use Think\Log; use Com\PackageValidate; use Common\Service\CustomtaskContentService; class SyncTitleController extends \Rpc\Controller\AbstractController { /** * SyncTitle * @author zhonglei * @desc 同步标题 * @param String app:true 应用 * @param Int app_data_id:true 应用数据ID * @param String title:true 标题 * @return bool */ public function Index() { Log::record('params: ' . var_export($this->_params, true), Log::INFO); $post_data = $this->_params; // 验证规则 $rules = [ 'app' => 'require', 'app_data_id' => 'require|integer', 'title' => 'require', ]; // 验证请求数据 $validate = new PackageValidate(); $validate->postData = $post_data; $validate->validateParams($rules); $conds = array_intersect_key_reserved($post_data, ['app', 'app_data_id'], true); $contentServ = new CustomtaskContentService(); $count = $contentServ->count_by_conds($conds); // 更新标题 if ($count > 0) { $result = $contentServ->update_by_conds($conds, ['title' => $post_data['title']]); Log::record("update customtask content title success {$result}", Log::INFO); return true; } return false; } }