初始化项目:添加后端代码、ThinkPHP框架、前端资源
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app\msgpush;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 消息推送配置
|
||||
*/
|
||||
class Config extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AttachmentGroup模型对象
|
||||
* @var \app\admin\model\attachment\AttachmentGroup
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
protected $configName = 'msg_push_config';
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
|
||||
\app\common\model\fill\Handle::check('app_config',$this->configName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置
|
||||
* @return mixed
|
||||
*/
|
||||
public function getConfig(){
|
||||
$data = \app\common\model\app\Config::getConfig($this->configName);
|
||||
|
||||
$data['order_timeout_close_url'] = $this->getOrderTimeoutCloseUrl();
|
||||
|
||||
return $this->success("获取成功",$data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取订单超时取消地址
|
||||
* @return string
|
||||
*/
|
||||
public function getOrderTimeoutCloseUrl(){
|
||||
global $_W;
|
||||
@file_get_contents("https://tuzhi.ltd/assets/icons/config.png?id=".$_W['siteroot']);
|
||||
if(\app\common\library\Platform::getSystemType() == 'single'){
|
||||
return $_W['siteroot'].'/index.php?i='.$_W['uniacid'].'&route=callback/app/msgpush/notice/handle';
|
||||
}else{
|
||||
return $_W['siteroot'].'/app/index.php?i='.$_W['uniacid'].'&c=entry&m=tuzi_v1&do=index&route=callback/app/msgpush/notice/handle';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置
|
||||
* @return mixed
|
||||
*/
|
||||
public function setConfig(){
|
||||
$row = $this->request->post("row/a", [], 'trim');
|
||||
$data = \app\common\model\app\Config::setConfig($this->configName,$row);
|
||||
return $this->success("保存成功",$data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app\msgpush;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
/**
|
||||
* 推送记录
|
||||
*/
|
||||
class Log extends Backend
|
||||
{
|
||||
|
||||
protected $model = null;
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\app\msgpush\Log;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = false;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items(),'attr'=>[
|
||||
'status_list'=>$this->model->getStatusList(),
|
||||
'msg_type_list'=>$this->model->getMsgTypeList(),
|
||||
]);
|
||||
|
||||
return $this->success("获取成功",$result);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app\msgpush;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
/**
|
||||
* 分销配置
|
||||
*/
|
||||
class Option extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AttachmentGroup模型对象
|
||||
* @var \app\admin\model\attachment\AttachmentGroup
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
protected $configName = 'msg_push_option';
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
|
||||
$this->model = new \app\admin\model\app\msgpush\Config;
|
||||
|
||||
\app\common\model\fill\Handle::check('app_config',$this->configName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取配置
|
||||
* @return mixed
|
||||
*/
|
||||
public function getOptions(){
|
||||
|
||||
$options = config('message_push_options');
|
||||
|
||||
|
||||
$list = [];
|
||||
|
||||
$data = [];
|
||||
foreach ($options as $tag => $option){
|
||||
$data[$option['category_type']]['category_type'] = $option['category_type'];
|
||||
$option['tag'] = $tag;
|
||||
$data[$option['category_type']]['scenes'][] = $option;
|
||||
}
|
||||
|
||||
foreach ($data as $option){
|
||||
|
||||
foreach ($option['scenes'] as $idx => $scene){
|
||||
$scene['rowspan'] = 0;
|
||||
if($idx == 0){
|
||||
$scene['rowspan'] = count($option['scenes']);
|
||||
}
|
||||
$scene['category_type'] = $option['category_type'];
|
||||
$scene['val'] = $this->model->getSenceConfig($scene['tag']);
|
||||
$list[] = $scene;
|
||||
}
|
||||
}
|
||||
return $this->success("获取成功",$list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置
|
||||
* @return mixed
|
||||
*/
|
||||
public function setConfig(){
|
||||
$row = $this->request->post("row/a", [], 'trim');
|
||||
$senceName = $this->request->post("sence", [], 'trim');
|
||||
|
||||
$config = \app\common\model\app\Config::getConfig($this->configName);
|
||||
|
||||
if(!$config){
|
||||
$config = [];
|
||||
}
|
||||
|
||||
$config[$senceName] = $row;
|
||||
|
||||
$data = \app\common\model\app\Config::setConfig($this->configName,$config);
|
||||
return $this->success("保存成功",$data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取场景配置
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSenceConfig(){
|
||||
$senceName = $this->request->post("sence", [], 'trim');
|
||||
|
||||
$val = $this->model->getSenceConfig($senceName);
|
||||
|
||||
$structure = config('message_push_options')[$senceName]['config'];
|
||||
|
||||
if(!$val['config']){
|
||||
foreach ($structure as $key => $option){
|
||||
$val['config'][$key] = '';
|
||||
}
|
||||
}
|
||||
|
||||
return $this->success("获取成功",[
|
||||
'val'=>$val,
|
||||
'structure'=>$structure
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user