C 簡訊傳送介面原始碼

2021-09-19 13:01:02 字數 2975 閱讀 7768

簡訊傳送介面原始碼(註冊,登入,改密)

//判斷傳送是否頻繁

var result = issendcaptchatooquick(mobile);

if (result != -1 && result < 120)

//驗證碼

string yzmnum = new random().next(100000, 1000000).tostring();

//傳送簡訊

//1註冊;2修改密碼;3繫結

string templateids = ;

string res = sendsms(mobile, yzmnum, templateids[type - 1]);

//記錄日誌

addsmslog("", mobile, "您本次的驗證碼為" + yzmnum + ",120秒有效", res, yzmnum);

commonhelper.writejson("ok", "成功");

}#region 傳送簡訊

/// /// 傳送簡訊

///

/// the mobile.

/// the content.

///

public string sendsms(string mobile, string yzmnum, string templateid)

";//必須是json格式

stringcontent sc = new stringcontent(str);

//必須新增報文頭contenttype

}/// /// 判斷手機驗證碼是否傳送頻繁

///

///

///

protected virtual double issendcaptchatooquick(string mobile)

string sql = @"select top 1 createdon from smslog where smstype=0 and reciever = @reciever and [returnval]='000000'

order by createdon desc";

sqlhelper helper = new sqlhelper("qpaccountsdbconnstr");

var createdon = helper.executescalar(sql, new sqlparameter() );

if (createdon != null)

return -1;

}/// /// 新增簡訊日誌

///

/// 沒用

/// 手機號

/// 沒用

/// 介面返回的資料,這個介面000000表示正確

/// 傳送的驗證碼

private void addsmslog(string sender, string reciever, string content,

string returnval = null, string smsvalue = null)

;//預設0表示是沒有使用的

var sql = @"

insert into [smslog]

(id,[smstype],[sender],[reciever],[content],[returnval],smsvalue,[createdon])

values

(@id,0,@sender,@reciever,@content,@returnval,@smsvalue,@createdon)";

sqlhelper helper = new sqlhelper("qpaccountsdbconnstr");

int count = helper.executenonquery(sql, parameters);

}#endregion

#region 驗證簡訊

private void verificationsms(string mobile, string smscode, int type)

, new sqlparameter() , new sqlparameter() );

if (createdon != null)

else

}else

}#endregion

public bool isreusable}}

}

PHP元件原始碼 簡訊傳送

原始碼介紹 環境需求 php 5.6 特點 支援目前市面多家服務商 一套寫法相容所有平台 簡單配置即可靈活增減服務商 內建多種服務商輪詢策略 支援自定義輪詢策略 統一的返回值格式,便於日誌與監控 自動輪詢選擇可用的服務商 更多等你去發現與改進 支援的平台 阿里雲 雲片submail 螺絲帽容聯雲通訊...

資料傳送介面原始碼示例

由於專案中經常需要寫各種對接的介面,此次決定花點心思設計一下,避免每次都重複開發。場景描述 重資料庫中讀取資料傳送至webservice介面,需要對傳送的資料進行確認。以往開發的痛點在於 要操作的表及表的字段不確定 對接的webservice介面及規範不統一,此原因在於對接的第三方。設計思路 如果請...

celery傳送簡訊介面

celery專案中的所有導包位址,都是以celery base dir為基準設定.執行celery命令時,也需要進入celery base dir目錄執行.celery base dir os.path.dirname os.path.abspath file true def send sms c...