Skip to content

Commit

Permalink
增加审核的功能,即编辑时修改状态
Browse files Browse the repository at this point in the history
  • Loading branch information
renyh committed Jul 10, 2018
1 parent 8459926 commit e4b7335
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 52 deletions.
6 changes: 3 additions & 3 deletions WebZ.Server/database/ZServerDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public async Task<ZServerItem> Add(ZServerItem item)
// 创建时间
item.id = Guid.NewGuid().ToString();
item.createTime = DateTimeUtil.DateTimeToString(DateTime.Now);
item.state = C_State_WaitForVerfity; // 未审核
//item.state = C_State_WaitForVerfity; // 未审核
item.verifier = "";
item.lastModifyTime = item.createTime;//新增时,两个时间一致,状态没改变时,会修改

Expand Down Expand Up @@ -100,8 +100,8 @@ public async Task<ZServerItem> Update(ZServerItem item)


// 辅助信息
//.Set("creatorPhone", item.creatorPhone)
//.Set("creatorIP", item.creatorIP)
.Set("creatorPhone", item.creatorPhone)
.Set("creatorIP", item.creatorIP)
//.Set("createTime", item.createTime)
.Set("state", item.state)
.Set("verifier", item.verifier)
Expand Down
70 changes: 50 additions & 20 deletions WebZ/ApiControllers/ZSerItemController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,35 @@ public int SendVerifyCode(string phone,
public ApiResult Post(string verifyCode,
string testMode,
[FromBody]ZServerItem item)
{
// 关于验证类等事情
ApiResult result = CheckInfo(verifyCode, testMode, item);
if (result.errorCode != 0)
return result;

// 保存站点信息
try
{
// 创建者ip地址
item.creatorIP = Request.HttpContext.Connection.RemoteIpAddress.ToString();
result.data = ServerInfo.Instance.AddZServerItem(item);
}
catch (Exception ex)
{
result.errorCode = -1;
result.errorInfo = ex.Message;
}

return result;



}


public ApiResult CheckInfo(string verifyCode,
string testMode,
[FromBody]ZServerItem item)
{
int nRet = 0;
string error = "";
Expand All @@ -143,6 +172,13 @@ public ApiResult Post(string verifyCode,
goto ERROR1;
}

// 只有公司的人才有审核权限
if (item.state != 0 && item.creatorPhone != "13862157150")
{
error = "您没有修改状态的权限,状态请设置为普通。";
goto ERROR1;
}

int nTestMode = 0;
try
{
Expand Down Expand Up @@ -192,12 +228,12 @@ public ApiResult Post(string verifyCode,
if (bSend == true)
{
error = "验证码已发到手机" + item.creatorPhone + ",请输入短信验证码。";
//+ "code=" + code; 放在result了
//+ "code=" + code; 放在result了
}
else
{
error = "请输入已经收到的手机短信验证码。";
//+ "code=" + code; 放在result了
//+ "code=" + code; 放在result了
}

// errorCode返回-2
Expand All @@ -210,7 +246,7 @@ public ApiResult Post(string verifyCode,
if (bSend == true)
{
error = "验证码无效,系统已重新给您手机号" + item.creatorPhone + "发送短信验证码,请输入新的验证码。";
//+ "code=" + code; 放在result了
//+ "code=" + code; 放在result了
goto ERROR1;
}
else
Expand All @@ -226,38 +262,32 @@ public ApiResult Post(string verifyCode,
}
}

// 保存站点信息
try
{
// 创建者ip地址
item.creatorIP = Request.HttpContext.Connection.RemoteIpAddress.ToString();
result.data = ServerInfo.Instance.AddZServerItem(item);
}
catch (Exception ex)
{
result.errorCode = -1;
result.errorInfo = ex.Message;
}

return result;


ERROR1:

result.errorCode = -1;
result.errorInfo = error;
return result;

}

// 一般有管理员审核修改
// PUT api/<controller>/5
[HttpPut("{id}")]
public ApiResult Put(string id, string verifyCode, [FromBody]ZServerItem item)
public ApiResult Put(string id, string verifyCode,
string testMode,
[FromBody]ZServerItem item)
{
ApiResult result = new ApiResult();
// 关于验证类等事情
ApiResult result = CheckInfo(verifyCode, testMode, item);
if (result.errorCode != 0)
return result;

try
{

// 创建者ip地址
item.creatorIP = Request.HttpContext.Connection.RemoteIpAddress.ToString();
result.data = ServerInfo.Instance.UpdateZServerItem(item);
}
catch (Exception ex)
Expand Down
103 changes: 74 additions & 29 deletions WebZ/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -501,10 +501,22 @@
// return;
//}
var remark = $(divId).find("#_remark").val()
var state = $(divId).find("#_state").val();
if (state == null || state == "")
state = 0;
else
state = parseInt($(divId).find("#_state").val());
//alert("state=" + state);
var testMode = getCheckboxValue("_test");//$(divId).find("#_firstfull").val();
//alert(firstfull);
var subjects = ""; //这里以逗号分隔
//显示等待图层
Expand Down Expand Up @@ -593,7 +605,9 @@
charNegoUtf8: charNegoUtf8,
charNego_recordsInSeletedCharsets: charNego_recordsInSeletedCharsets,
queryTermEncoding: queryTermEncoding,
defaultEncoding: defaultEncoding
defaultEncoding: defaultEncoding,
state: state,
remark: remark
}
);
Expand Down Expand Up @@ -723,7 +737,12 @@
var creatorIP = ""; //创建者ip
var createTime = "";
var state = ""; //状态,0 未审核,1审核通过,2审核不通过
var state_0 = "";
var state_1 = "";
var state_2 = "";
var remark = "";
var verifier = ""; //审核人
var verifyTime = ""; //审核时间
Expand Down Expand Up @@ -796,6 +815,14 @@
creatorIP = item.creatorIP;
createTime = item.createTime;
state = item.state;
if (state == 0)
state_0 = " selected ";
else if (state == 1)
state_1 = " selected ";
else if (state == 2)
state_2 = " selected ";
remark = item.remark;
verifier = item.verifier;
verifyTime = item.verifyTime;
Expand Down Expand Up @@ -894,13 +921,13 @@
<label>权限验证方式</label>\
<div class='field'>\
<div class='ui radio checkbox'>\
<input name='_authmethod' type='radio' "+ authmethod_open_str+" value='0'>\
<input name='_authmethod' type='radio' "+ authmethod_open_str + " value='0'>\
<label>Open</label>\
</div>\
</div>\
<div class='field'>\
<div class='ui radio checkbox'>\
<input name='_authmethod' type='radio' "+ authmethod_idpassword_str+" value='1'>\
<input name='_authmethod' type='radio' "+ authmethod_idpassword_str + " value='1'>\
<label>ID/Password</label>\
</div>\
</div>\
Expand Down Expand Up @@ -948,59 +975,59 @@
<label>缺省数据格式OID</label>\
<select id='_defaultMarcSyntaxOID'>\
<option value=''></option>\
<option value='UNIMARC' "+ defaultMarcSyntaxOID_UNIMARC+">1.2.840.10003.5.1 -- UNIMARC</option>\
<option value='MARC21' "+ defaultMarcSyntaxOID_MARC21+">1.2.840.10003.5.10 -- MARC21</option>\
<option value='SUTRS' "+ defaultMarcSyntaxOID_SUTRS+">1.2.840.10003.5.101 -- SUTRS</option>\
<option value='XML' "+ defaultMarcSyntaxOID_XML+">1.2.840.10003.5.109.10 -- XML</option>\
<option value='UNIMARC' "+ defaultMarcSyntaxOID_UNIMARC + ">1.2.840.10003.5.1 -- UNIMARC</option>\
<option value='MARC21' "+ defaultMarcSyntaxOID_MARC21 + ">1.2.840.10003.5.10 -- MARC21</option>\
<option value='SUTRS' "+ defaultMarcSyntaxOID_SUTRS + ">1.2.840.10003.5.101 -- SUTRS</option>\
<option value='XML' "+ defaultMarcSyntaxOID_XML + ">1.2.840.10003.5.109.10 -- XML</option>\
</select>\
</div>\
<div class='inline field'>\
<label>缺省元素集名</label>\
<select id='_defaultElementSetName'>\
<option value=''></option>\
<option value='B' "+ defaultElementSetName_B+">B -- Brief(MARC records)</option>\
<option value='F' "+ defaultElementSetName_F +">F -- Full (MARC and OPAC records)</option>\
<option value='dc' "+ defaultElementSetName_dc +">dc -- Dublin Core (XML records)</option>\
<option value='mods' "+ defaultElementSetName_mods +">mods -- MODS (XML records)</option>\
<option value='marcxml' "+ defaultElementSetName_marcxml +">marcxml -- MARCXML (XML records), default schema for XML</option>\
<option value='opacxml' "+ defaultElementSetName_opacxml +">opacxml -- MARCXML with holdings attached</option>\
<option value='B' "+ defaultElementSetName_B + ">B -- Brief(MARC records)</option>\
<option value='F' "+ defaultElementSetName_F + ">F -- Full (MARC and OPAC records)</option>\
<option value='dc' "+ defaultElementSetName_dc + ">dc -- Dublin Core (XML records)</option>\
<option value='mods' "+ defaultElementSetName_mods + ">mods -- MODS (XML records)</option>\
<option value='marcxml' "+ defaultElementSetName_marcxml + ">marcxml -- MARCXML (XML records), default schema for XML</option>\
<option value='opacxml' "+ defaultElementSetName_opacxml + ">opacxml -- MARCXML with holdings attached</option>\
</select>\
</div>\
<div class='ui toggle checkbox field'>\
<input type='checkbox' id='_firstfull' "+ firstfullCkdStr+">\
<input type='checkbox' id='_firstfull' "+ firstfullCkdStr + ">\
<label>在获取浏览记录阶段即获取全记录</label>\
</div>\
<br />\
<div class='ui toggle checkbox field'>\
<input type='checkbox' id='_detectmarcsyntax' "+ detectmarcsyntaxStr+">\
<input type='checkbox' id='_detectmarcsyntax' "+ detectmarcsyntaxStr + ">\
<label>自动探测MARC记录格式</label>\
</div>\
<br />\
<div class='ui toggle checkbox field'>\
<input type='checkbox' id='_ignorereferenceid' "+ ignorereferenceidStr+">\
<input type='checkbox' id='_ignorereferenceid' "+ ignorereferenceidStr + ">\
<label>不检查Reference</label>\
</div>\
</div>\
<div class='ui segment'>\
<p>ISBN检索前,对检索词作如下预处理:</p>\
<div class='ui checkbox field'>\
<input type='checkbox' id='_isbn_force13' "+ isbn_force13Str+">\
<input type='checkbox' id='_isbn_force13' "+ isbn_force13Str + ">\
<label>规整为13位形态&nbsp;&nbsp;&nbsp;&nbsp;</label>\
</div>\
<div class='ui checkbox field'>\
<input type='checkbox' id='_isbn_force10' "+ isbn_force10Str+">\
<input type='checkbox' id='_isbn_force10' "+ isbn_force10Str + ">\
<label>规整为10位形态&nbsp;&nbsp;&nbsp;&nbsp;</label>\
</div>\
<div class='ui checkbox field'>\
<input type='checkbox' id='_isbn_addhyphen' "+ isbn_addhyphenStr+">\
<input type='checkbox' id='_isbn_addhyphen' "+ isbn_addhyphenStr + ">\
<label>加入横杠&nbsp;&nbsp;&nbsp;&nbsp;</label>\
</div>\
<div class='ui checkbox field'>\
<input type='checkbox' id='_isbn_removehyphen' "+ isbn_removehyphenStr+">\
<input type='checkbox' id='_isbn_removehyphen' "+ isbn_removehyphenStr + ">\
<label>去除横杠&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>\
</div>\
<div class='ui checkbox field'>\
<input type='checkbox' id='_isbn_wild' "+ isbn_wildStr+">\
<input type='checkbox' id='_isbn_wild' "+ isbn_wildStr + ">\
<label>野蛮匹配&nbsp;&nbsp;&nbsp;&nbsp;</label>\
</div>\
</div>\
Expand All @@ -1009,32 +1036,50 @@
<label>检索词缺省编码方式</label>\
<select id='_queryTermEncoding'>\
<option value=''></option>\
<option value='gb2312' "+ queryTermEncoding_gb2312+">gb2312</option>\
<option value='utf-8' "+ queryTermEncoding_utf8+">utf-8</option>\
<option value='gb2312' "+ queryTermEncoding_gb2312 + ">gb2312</option>\
<option value='utf-8' "+ queryTermEncoding_utf8 + ">utf-8</option>\
</select>\
</div>\
<div class='inline field'>\
<label>数据记录缺省编码方式</label>\
<select id='_defaultEncoding'>\
<option value=''></option>\
<option value='gb2312' "+ defaultEncoding_gb2312 +">gb2312</option>\
<option value='gb2312' "+ defaultEncoding_gb2312 + ">gb2312</option>\
<option value='utf-8' "+ defaultEncoding_utf8 + ">utf-8</option>\
<option value='MARC-8' "+ defaultEncoding_MARC8 +">MARC-8</option>\
<option value='MARC-8' "+ defaultEncoding_MARC8 + ">MARC-8</option>\
</select>\
</div>\
<div class='ui toggle checkbox field'>\
<input type='checkbox' id='_charNegoUtf8' "+ charNegoUtf8Str+">\
<input type='checkbox' id='_charNegoUtf8' "+ charNegoUtf8Str + ">\
<label>启用字符集协商功能,优先为检索词选用UTF-8编码方式</label>\
</div>\
<br />\
<div class='ui toggle checkbox field'>\
<input name='public' type='checkbox' id='_charNego_recordsInSeletedCharsets' "+ charNego_recordsInSeletedCharsetsStr+">\
<input name='public' type='checkbox' id='_charNego_recordsInSeletedCharsets' "+ charNego_recordsInSeletedCharsetsStr + ">\
<label>若启用了字符集协商功能,令数据记录也一同采用UTF-8编码试</label>\
</div>\
</div>\
</div>\
</div>\
<br />\
</div>";
if (item != null) {
h += " <div class='ui segment' >\
<div class=' inline field '>\
<label>状态</label>\
<select id='_state'>\
<option value='0' "+ state_0 + ">未审核</option>\
<option value='1' "+ state_1 + ">审核通过</option>\
<option value='2' "+ state_2 + ">审核不通过</option>\
</select>\
</div>\
<div class='inline field'>\
<label>审核备注</label >\
<textarea rows='2' id='_remark'>"+ remark + "</textarea>\
</div >\
</div >";
}
h+="<br/>\
<div class='ui button' onclick=\"save('" + msgId + "')\">" + saveBtnName + "</div>\
<div class='ui button' onclick=\"cancelEdit('" + msgId + "')\">取消</div>\
</div>";
Expand Down

0 comments on commit e4b7335

Please sign in to comment.