Files
duolamaojiazhen/application/admin/controller/Message.php
2025-12-22 13:59:40 +08:00

62 lines
1.9 KiB
PHP

<?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('短信发送失败');
}
}
}