Example #1
0
 public function view_ajaxGetTpl()
 {
     $tid = isset($_GET['tid']) ? trim($_GET['tid']) : 0;
     if (!(is_numeric($tid) && $tid > 0)) {
         //tid不合法
         $msgdata = array('errCode' => 9001, 'errMsg' => '模板不合法!');
         echo json_encode($msgdata);
         exit;
     }
     $tpl_obj = new MessageTemplateModel();
     $tpl_info = $tpl_obj->getTplInfoById($tid);
     if (empty($tid)) {
         $msgdata = array('errCode' => 9002, 'errMsg' => '模板不存在!');
         echo json_encode($msgdata);
         exit;
     } else {
         $msgdata = array('errCode' => 9003, 'errMsg' => '', 'data' => $tpl_info['content']);
         echo json_encode($msgdata);
         exit;
     }
 }
Example #2
0
 public function view_ajaxDelTemplate()
 {
     $tid = isset($_GET['tid']) ? $_GET['tid'] : 0;
     if (!is_numeric($tid)) {
         //tid不合法
         $msgar = array('code' => 7001, 'msg' => 'id不合法!');
         echo json_encode($msgar);
         exit;
     }
     if ($tid === 0) {
         //没指定id
         $msgar = array('code' => 7002, 'msg' => '请指定id!');
         echo json_encode($msgar);
         exit;
     }
     $msgtpl_obj = new MessageTemplateModel();
     $delres = $msgtpl_obj->delTplById($tid);
     if ($delres) {
         //删除成功
         $msgar = array('code' => 7003, 'msg' => '删除成功!');
         echo json_encode($msgar);
         exit;
     } else {
         $msgar = array('code' => 7004, 'msg' => '删除失败!');
         echo json_encode($msgar);
         exit;
     }
 }