/** * 编辑工作日设置 */ public function editworkdayAction() { // 返回值数组 $result = array('success' => true, 'info' => '编辑成功'); $request = $this->getRequest()->getParams(); $now = date('Y-m-d H:i:s'); $user_session = new Zend_Session_Namespace('user'); $user_id = $user_session->user_info['user_id']; $json = json_decode($request['json']); $updated = $json->updated; $workday = new Hra_Model_Workday(); if (count($updated) > 0) { foreach ($updated as $val) { $data = array('type' => $val->type, 'remark' => $val->remark, 'update_time' => $now, 'update_user' => $user_id); $where = "id = " . $val->id; try { $workday->update($data, $where); } catch (Exception $e) { $result['success'] = false; $result['info'] = $e->getMessage(); echo Zend_Json::encode($result); exit; } } } echo Zend_Json::encode($result); exit; }