阿里云接收上行短信|阿里云接收上行短信

DROP TABLE IF EXISTS `smsup`;
CREATE TABLE `smsup`  (
  `smsup_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
  `smsup_sendtime` datetime(0) NOT NULL COMMENT '发送时间',
  `smsup_phonenumber` char(11) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '手机号码',
  `smsup_content` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '发送内容',
  `smsup_signname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '签名信息',
  `smsup_destcode` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '上行短信扩展码',
  `smsup_sequenceid` bigint(20) NOT NULL COMMENT '序列号',
  PRIMARY KEY (`smsup_id`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '接收短信上行记录' ROW_FORMAT = Dynamic;
namespace Root\Controller;
class SmsupController extends \Think\Controller{
     
	//阿里云→短信服务→系统设置→通用设置→上行消息通知→HTTP批量推送模式→设置callback地址

	function index(){
     
		$arr=jsondecode(file_get_contents("php://input"));
		foreach($arr as $item){
     
			M('Smsup')->add([
				'smsup_destcode'=>$item['dest_code'],
				'smsup_sendtime'=>$item['send_time'],
				'smsup_signname'=>$item['sign_name'],
				'smsup_sequenceid'=>$item['sequence_id'],
				'smsup_phonenumber'=>$item['phone_number'],
				'smsup_content'=>$item['content'],
			]);
		}
		$this->ajaxReturn([
			'code'=>0,
			'msg'=>'成功',
		]);
	}

}

你可能感兴趣的:(PHP,ThinkPHP3.2.5)