添加网站文件
This commit is contained in:
62
application/admin/controller/Message.php
Normal file
62
application/admin/controller/Message.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller;
|
||||
use app\admin\logic\MessageLogic;
|
||||
use think\Db;
|
||||
|
||||
class Message extends AdminBase{
|
||||
|
||||
public function config(){
|
||||
$config = MessageLogic::config();
|
||||
$this->assign('config',$config);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
public function set(){
|
||||
$id = $this->request->get('id',1);
|
||||
if($this->request->isAjax()){
|
||||
$post = $this->request->post();
|
||||
MessageLogic::setConfig($post);
|
||||
$this->_success('设置成功');
|
||||
|
||||
|
||||
}
|
||||
$info = MessageLogic::getMessage($id);
|
||||
$this->assign('info',$info);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
//短信推广通知设置
|
||||
public function Message(){
|
||||
if($this->request->isAjax()){
|
||||
$post = $this->request->post();
|
||||
|
||||
MessageLogic::addmess($post);
|
||||
$this->_success('设置成功');
|
||||
|
||||
}
|
||||
$config=Db::name('user_message')->where('id',1)->find();
|
||||
$this->assign('config', $config);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
|
||||
public function messageadd(){
|
||||
$post = $this->request->post('user_ids');
|
||||
$useradder=Db::name('user_address')->where('id',$post[0])->find(); //查询用户的电话
|
||||
$smsapi = "http://api.smsbao.com/";
|
||||
$user = "connoryz"; //短信平台帐号
|
||||
$pass = md5("90625110aa"); //短信平台密码
|
||||
$content="【哆啦猫日式家政】短信内容";//要发送的短信内容
|
||||
$phone = $useradder['telephone'];//要发送短信的手机号码
|
||||
$sendurl = $smsapi."sms?u=".$user."&p=".$pass."&m=".$phone."&c=".urlencode($content);
|
||||
$result =file_get_contents($sendurl) ;
|
||||
if($result==0){
|
||||
$this->_success('发送短信成功,请勿重新发送',$result);
|
||||
}else{
|
||||
$this->_error('短信发送失败');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user