Example #1
0
 function act_sureAddMenu()
 {
     $bool = array();
     $data = array();
     $id = trim($_POST['menuId']);
     $data['statusName'] = post_check(trim($_POST['statusName']));
     if (empty($_POST['groupId'])) {
         $data['groupId'] = '0';
     } else {
         $data['groupId'] = $_POST['groupId'];
     }
     $data['sort'] = post_check(trim($_POST['sort']));
     $data['note'] = post_check(trim($_POST['note']));
     if (empty($id)) {
         $data['statusCode'] = post_check(trim($_POST['statusCode']));
         $bool = StatusMenuModel::getStatusMenuList("*", "where statusName='{$data['statusName']}' and is_delete=0 and storeId=1");
         if ($bool) {
             return 2;
         }
         return StatusMenuModel::insertRow($data);
         $insertid = StatusMenuModel::insertRow($data);
         if ($insertid) {
             return 1;
         } else {
             return false;
         }
     } else {
         $bool = StatusMenuModel::getStatusMenuList("*", "where id!={$id} and statusName='{$data['statusName']}' and is_delete=0 and storeId=1");
         if ($bool) {
             return 2;
         }
         $updatedata = StatusMenuModel::update($data, "and id='{$id}'");
         if ($updatedata) {
             return 1;
         } else {
             return false;
         }
     }
 }