一個項目又開發(fā)完成了,雖然時間短問題多,但還是有一,二總結
成都創(chuàng)新互聯(lián)公司是網(wǎng)站建設專家,致力于互聯(lián)網(wǎng)品牌建設與網(wǎng)絡營銷,專業(yè)領域包括成都網(wǎng)站設計、網(wǎng)站制作、外貿營銷網(wǎng)站建設、電商網(wǎng)站制作開發(fā)、成都微信小程序、微信營銷、系統(tǒng)平臺開發(fā),與其他網(wǎng)站設計及系統(tǒng)開發(fā)公司不同,我們的整合解決方案結合了恒基網(wǎng)絡品牌建設經(jīng)驗和互聯(lián)網(wǎng)整合營銷的理念,并將策略和執(zhí)行緊密結合,且不斷評估并優(yōu)化我們的方案,為客戶提供全方位的互聯(lián)網(wǎng)品牌整合方案!1、kendo中如果使用 data-role="datetimepicker"日期時間選擇器,時間選擇列表總是不能初始化,需要選擇兩次日期,才會出現(xiàn)時間選擇列表。第三方組件啊,讓人頭痛,一一排除后,竟然在這里。
Date.prototype.toString = function (formatStr) {
// --- //
return str;
}
自定義了日期類型的方法toString("yyyy-MM-dd"),該方法本來是沒有錯誤的,但是和kendo的日期時間沖突了,將 toString 換成 format 問題解決,原來toString這個方法,kendo有另外的定義,看來自定義的名稱還是要個性化。
2、項目開發(fā)時間短,數(shù)據(jù)建模不是同一人完成的,缺乏了整體的規(guī)劃,在模塊數(shù)據(jù)交叉的地方,出現(xiàn)后期難以整合的問題,看來以后建模和數(shù)據(jù)庫還是要整體規(guī)劃,功能開發(fā)上可以各司其職。
3、JPUSH推送
JPUSH封裝后使用就非常簡單了。
namespace JPush
{
public class JPushUtil
{
protected const string apiBaseUrl = "https://api.jpush.cn/v3/";
static JPushUtil()
{
appkeys = ConfigurationManager.AppSettings["OwnerAppkey"];
master_secret = ConfigurationManager.AppSettings["OwnerSecret"];
}
public static string appkeys
{
get;
set;
}
public static string master_secret
{
get;
set;
}
public static string GenerateQueryToken(string appKey, string masterSecret)
{
string s = string.Format("{0}:{1}", appKey, masterSecret);
Encoding encoding = Encoding.UTF8;
try
{
byte[] bytes = encoding.GetBytes(s);
return Convert.ToBase64String(bytes);
}
catch
{
return string.Empty;
}
}
public static string Send(string data,string url="")
{
string result = "";
url = apiBaseUrl + "push";
HttpWebRequest httpRequest = (HttpWebRequest)HttpWebRequest.Create(url);
httpRequest.Credentials = new NetworkCredential(appkeys, master_secret);
httpRequest.Headers[HttpRequestHeader.Authorization] = "Basic " + GenerateQueryToken(appkeys, master_secret);
byte[] byteArray = null;
byteArray = Encoding.UTF8.GetBytes(data);
httpRequest.Method = "POST";
httpRequest.ContentType = "text/xml; charset=utf-8";
httpRequest.ContentLength = byteArray.Length;
Stream dataStream = httpRequest.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
WebResponse response = null;
try
{
response = httpRequest.GetResponse();
}
catch (WebException e)
{
response = e.Response;
}
string responseContent = string.Empty;
using (Stream responseStream = response.GetResponseStream())
{
StreamReader streamReader = new StreamReader(responseStream, Encoding.UTF8);
responseContent = streamReader.ReadToEnd();
}
response.Close();
if (!string.IsNullOrEmpty(responseContent))
{
result = responseContent;
}
return result;
}
static object lockObj = new object();
protected static int GenerateSendIdentity()
{
lock (lockObj)
{
return (int)(((DateTime.UtcNow - new DateTime(2014, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds) % Int32.MaxValue);
}
}
public static PushResponse DPdoSend(int receiverType, string receiverValue, string title, string n_content, string param,
int time_to_live = 864000, string apns_production = "False")
{
appkeys = ConfigurationManager.AppSettings["DPappkey"];
master_secret = ConfigurationManager.AppSettings["DPsecret"];
return doSend(receiverType, receiverValue, title, n_content, param, time_to_live, apns_production);
}
public static PushResponse OwnerdoSend(int receiverType, string receiverValue, string title, string n_content, string param,
int time_to_live = 864000, string apns_production = "False")
{
appkeys = ConfigurationManager.AppSettings["OwnerAppkey"];
master_secret = ConfigurationManager.AppSettings["OwnerSecret"];
return doSend(receiverType, receiverValue, title, n_content, param, time_to_live, apns_production);
}
public static PushResponse JYdoSend(int receiverType, string receiverValue, string title, string n_content, string param,
int time_to_live = 864000, string apns_production = "False")
{
appkeys = ConfigurationManager.AppSettings["JYappkey"];
master_secret = ConfigurationManager.AppSettings["JYsecret"];
return doSend(receiverType, receiverValue, title, n_content, param, time_to_live, apns_production);
}
public static PushResponse doSend( int receiverType, string receiverValue, string title, string n_content, string param,
int time_to_live = 864000,string apns_production="False")
{
StringBuilder sb=new StringBuilder();
sb.AppendLine("{");
sb.AppendLine("\"platform\": [\"android\",\"ios\"],");
sb.AppendLine("\"audience\":{");
if(receiverType==2)
{
sb.AppendLine(" \"tag\" : [\""+receiverValue+"\"]");
}
else
{
sb.AppendLine(" \"alias\" : [\""+receiverValue.Replace(",","\",\"")+"\"]");
}
sb.AppendLine("}");
sb.AppendLine(",\"message\": {");
sb.AppendFormat(" \"msg_content\":\"{0}\",",n_content.Replace("\"","") );
sb.AppendLine();
sb.AppendFormat(" \"title\":\"{0}\",",title.Replace("\"","") );
sb.AppendLine();
sb.AppendFormat(" \"extras\": {0} ",param );
sb.AppendLine();
sb.AppendLine(" }");
sb.AppendLine(",\"options\": {");
sb.AppendFormat(" \"sendno\":{0},",GenerateSendIdentity() );
sb.AppendLine();
sb.AppendFormat(" \"time_to_live\":{0},", time_to_live);
sb.AppendLine();
sb.AppendFormat(" \"apns_production\": \"{0}\"", apns_production);
sb.AppendLine();
sb.AppendLine(" }");
sb.AppendLine("}");
PushResponse result = new PushResponse();
result.ResponseCode = -1;
try
{
string result1 = Send(sb.ToString());
JToken root = JToken.Parse(result1);
try
{
result.MessageId = root.SelectToken("msg_id").Value<string>();
}
catch
{ }
var errorNode = root.SelectToken("error");
if (errorNode == null)
{
result.SendIdentity = root.SelectToken("sendno").Value<string>();
result.ResponseCode = 0;
}
else
{
result.ResponseMessage = errorNode.SelectToken("message").Value<string>();
result.ResponseCode = errorNode.SelectToken("code").Value<int>();
}
}
catch (Exception ex)
{
throw new ST.Exceptions.CanShowException(ex.Message);
}
return result;
}
}
}
在需要的地方直接調用就OK。
4、.net下操作Redis的不明白地方
簡寫實例說明
using (IRedisClient irc = ST.Cache.RedisManage.GetClient())
{
IRedisTypedClient<MY_View> redis = irc.As<MY_View>();
var lold = redis.Lists["KEY"];
var m1 = lold.Where(a => a.ID == id).SingleOrDefault();
if (m1 != null)
{
lold.RemoveValue(m1);
}
}
Redis中<key,value>value為列表的,采用 RemoveValue,或 redis.RemoveItemFromList(lold, m1)均不能刪除,最后還是改為刪除整個鍵,然后再重新添加列表,費時費力,現(xiàn)在功能是完成熬,還沒找到問題癥結。只有用這個折中的辦法。
5、MVC路由的一種實現(xiàn)
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"M_default",
"M/{controller}/{action}/{Token}",
new { action = "Index", Token = UrlParameter.Optional },
new string[] { "ST.WEB.Areas.M" }
).DataTokens["UseNamespaceFallback"] = true;
}
DataTokens["UseNamespaceFallback"] = true,前面命名空間沒有找到控制,其它地方繼續(xù)
false是只在列出的命名空間查找,命名空間是任意的,不一定都 設置在controlls下。
創(chuàng)新互聯(lián)www.cdcxhl.cn,專業(yè)提供香港、美國云服務器,動態(tài)BGP最優(yōu)骨干路由自動選擇,持續(xù)穩(wěn)定高效的網(wǎng)絡助力業(yè)務部署。公司持有工信部辦法的idc、isp許可證, 機房獨有T級流量清洗系統(tǒng)配攻擊溯源,準確進行流量調度,確保服務器高可用性。佳節(jié)活動現(xiàn)已開啟,新人活動云服務器買多久送多久。
網(wǎng)站名稱:項目開發(fā)收尾總結(片段)-創(chuàng)新互聯(lián)
文章源于:http://m.rwnh.cn/article32/djippc.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站收錄、微信小程序、定制網(wǎng)站、做網(wǎng)站、網(wǎng)站設計公司、網(wǎng)站設計
聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)