862 lines
15 KiB
PHP
862 lines
15 KiB
PHP
<?php
|
|
namespace app\farm\controller;
|
|
use app\AdminRest;
|
|
use app\farm\model\AboutUs;
|
|
use app\farm\model\SendConfig;
|
|
use app\farm\model\WelfareColumn;
|
|
use app\restaurant\model\Table;
|
|
use app\farm\model\Article;
|
|
use app\farm\model\Banner;
|
|
use app\shop\model\MsgConfig;
|
|
use app\farm\model\PayConfig;
|
|
use think\App;
|
|
use app\farm\model\Config as Model;
|
|
|
|
|
|
class AdminSetting extends AdminRest
|
|
{
|
|
|
|
|
|
protected $model;
|
|
|
|
|
|
public function __construct(App $app) {
|
|
|
|
parent::__construct($app);
|
|
|
|
$this->model = new Model();
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-03-12 15:04
|
|
* @功能说明:配置详情
|
|
*/
|
|
public function configInfo(){
|
|
|
|
|
|
$dis = [
|
|
|
|
'uniacid' => $this->_uniacid
|
|
];
|
|
|
|
$data = $this->model->dataInfo($dis);
|
|
|
|
return $this->success($data);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-03-12 16:14
|
|
* @功能说明:编辑配置
|
|
*/
|
|
public function configUpdate(){
|
|
|
|
$input = $this->_input;
|
|
|
|
$dis = [
|
|
|
|
'uniacid' => $this->_uniacid
|
|
];
|
|
|
|
if(!empty($input['app_banner'])){
|
|
|
|
$input['app_banner'] = implode(',',$input['app_banner']);
|
|
}
|
|
|
|
$data = $this->model->dataUpdate($dis,$input);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-03-12 16:15
|
|
* @功能说明:banner列表
|
|
*/
|
|
public function bannerList(){
|
|
|
|
$input = $this->_param;
|
|
|
|
$dis[] = ['uniacid','=',$this->_uniacid];
|
|
|
|
$dis[] = ['status','>',-1];
|
|
|
|
if(!empty($input['type'])){
|
|
|
|
$dis[] = ['type','=',$input['type']];
|
|
|
|
}
|
|
|
|
$banner_model = new Banner();
|
|
|
|
$data = $banner_model->dataList($dis,$input['limit']);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-03-12 16:18
|
|
* @功能说明:添加banner
|
|
*/
|
|
public function bannerAdd(){
|
|
|
|
$input = $this->_input;
|
|
|
|
$input['uniacid'] = $this->_uniacid;
|
|
|
|
$banner_model = new Banner();
|
|
|
|
$res = $banner_model->dataAdd($input);
|
|
|
|
return $this->success($res);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-03-12 16:20
|
|
* @功能说明:编辑banner
|
|
*/
|
|
public function bannerUpdate(){
|
|
|
|
$input = $this->_input;
|
|
|
|
$dis = [
|
|
|
|
'id' => $input['id']
|
|
];
|
|
|
|
$banner_model = new Banner();
|
|
|
|
$input['uniacid'] = $this->_uniacid;
|
|
|
|
|
|
$res = $banner_model->dataUpdate($dis,$input);
|
|
|
|
return $this->success($res);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-03-19 13:27
|
|
* @功能说明:banner详情
|
|
*/
|
|
public function bannerInfo(){
|
|
|
|
$input = $this->_param;
|
|
|
|
$dis = [
|
|
|
|
'id' => $input['id']
|
|
];
|
|
|
|
$banner_model = new Banner();
|
|
|
|
$res = $banner_model->dataInfo($dis);
|
|
|
|
return $this->success($res);
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-03-12 16:27
|
|
* @功能说明:新闻列表
|
|
*/
|
|
public function articleList(){
|
|
|
|
$input = $this->_param;
|
|
|
|
$article_model = new Article();
|
|
|
|
$dis[] = ['uniacid','=',$this->_uniacid];
|
|
|
|
$dis[] = ['status','>',-1];
|
|
|
|
if(!empty($input['title'])){
|
|
|
|
$dis[] = ['title','like','%'.$input['title'].'%'];
|
|
}
|
|
|
|
$data = $article_model->dataList($dis,$input['limit']);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-03-12 16:37
|
|
* @功能说明:添加文章
|
|
*
|
|
*/
|
|
public function articleAdd(){
|
|
|
|
$input = $this->_input;
|
|
|
|
$article_model = new Article();
|
|
|
|
$input['uniacid'] = $this->_uniacid;
|
|
|
|
$res = $article_model->dataAdd($input);
|
|
|
|
return $this->success($res);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-03-19 13:35
|
|
* @功能说明:编辑文章
|
|
*/
|
|
public function articleUpdate(){
|
|
|
|
$input = $this->_input;
|
|
|
|
$article_model = new Article();
|
|
|
|
$dis = [
|
|
|
|
'id' => $input['id']
|
|
];
|
|
|
|
$res = $article_model->dataUpdate($dis,$input);
|
|
|
|
return $this->success($res);
|
|
|
|
}
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-03-19 13:35
|
|
* @功能说明:文章详情
|
|
*/
|
|
public function articleInfo(){
|
|
|
|
$input = $this->_param;
|
|
|
|
$article_model = new Article();
|
|
|
|
$dis = [
|
|
|
|
'id' => $input['id']
|
|
];
|
|
|
|
$res = $article_model->dataInfo($dis);
|
|
|
|
return $this->success($res);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-03-19 13:50
|
|
* @功能说明:文章下拉框
|
|
*/
|
|
public function articleSelect(){
|
|
|
|
$input = $this->_param;
|
|
|
|
$article_model = new Article();
|
|
|
|
$dis = [
|
|
|
|
'uniacid' => $this->_uniacid,
|
|
|
|
'status' => 1
|
|
];
|
|
|
|
$res = $article_model->where($dis)->field('id,title')->order('top desc,id desc')->select()->toArray();
|
|
|
|
return $this->success($res);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-03-18 10:53
|
|
* @功能说明:支付配置详情
|
|
*/
|
|
public function payConfigInfo(){
|
|
|
|
$dis = [
|
|
|
|
'uniacid' => $this->_uniacid
|
|
];
|
|
|
|
$pay_model = new PayConfig();
|
|
|
|
$data = $pay_model->dataInfo($dis);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-03-18 10:55
|
|
* @功能说明:编辑支付配置
|
|
*/
|
|
public function payConfigUpdate(){
|
|
|
|
$input = $this->_input;
|
|
|
|
|
|
$dis = [
|
|
|
|
'uniacid' => $this->_uniacid
|
|
];
|
|
|
|
|
|
if(isset($input['cert_path'])&&isset($input['key_path'])){
|
|
|
|
if(!strstr($input['cert_path'],FILE_UPLOAD_PATH)){
|
|
|
|
$input['cert_path'] = FILE_UPLOAD_PATH.$input['cert_path'];
|
|
|
|
}
|
|
if(!strstr($input['key_path'],FILE_UPLOAD_PATH)){
|
|
|
|
$input['key_path'] = FILE_UPLOAD_PATH.$input['key_path'];
|
|
}
|
|
}
|
|
|
|
$pay_model = new PayConfig();
|
|
|
|
$data = $pay_model->dataUpdate($dis,$input);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-03-31 15:16
|
|
* @功能说明:修改密码
|
|
*/
|
|
public function updatePass(){
|
|
|
|
$input = $this->_input;
|
|
|
|
$admin = new \app\farm\model\Admin();
|
|
|
|
$update = [
|
|
|
|
'passwd' => checkPass($input['pass']),
|
|
];
|
|
|
|
$res = $admin->dataUpdate(['uniacid'=>$this->_uniacid],$update);
|
|
|
|
|
|
|
|
return $this->success($res);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-03-12 15:04
|
|
* @功能说明:配置详情
|
|
*/
|
|
public function msgConfigInfo(){
|
|
|
|
$msg_model = new MsgConfig();
|
|
|
|
$dis = [
|
|
|
|
'uniacid' => $this->_uniacid
|
|
];
|
|
|
|
$data = $msg_model->dataInfo($dis);
|
|
|
|
return $this->success($data);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-03-12 16:14
|
|
* @功能说明:编辑配置
|
|
*/
|
|
public function msgConfigUpdate(){
|
|
|
|
$input = $this->_input;
|
|
|
|
$msg_model = new MsgConfig();
|
|
|
|
$dis = [
|
|
|
|
'uniacid' => $this->_uniacid
|
|
];
|
|
|
|
$data = $msg_model->dataUpdate($dis,$input);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-11-08 11:58
|
|
* @功能说明:桌号列表
|
|
*/
|
|
public function tableList(){
|
|
|
|
$input = $this->_param;
|
|
|
|
$dis[] = ['uniacid','=',$this->_uniacid];
|
|
|
|
$dis[] = ['status','>',-1];
|
|
|
|
if(!empty($input['title'])){
|
|
|
|
$dis[] = ['title','like','%'.$input['title'].'%'];
|
|
}
|
|
|
|
$table_model = new Table();
|
|
|
|
$data = $table_model->dataList($dis,$input['limit']);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-11-08 13:21
|
|
* @功能说明:添加桌号
|
|
*/
|
|
public function tableAdd(){
|
|
|
|
$input = $this->_input;
|
|
|
|
$input['uniacid'] = $this->_uniacid;
|
|
|
|
$table_model = new Table();
|
|
|
|
$res = $table_model->dataAdd($input);
|
|
|
|
return $this->success($res);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-11-08 13:23
|
|
* @功能说明:编辑桌号
|
|
*/
|
|
public function tableUpdate(){
|
|
|
|
$input = $this->_input;
|
|
|
|
$dis = [
|
|
|
|
'id' => $input['id']
|
|
];
|
|
|
|
$table_model = new Table();
|
|
|
|
$res = $table_model->dataUpdate($dis,$input);
|
|
|
|
return $this->success($res);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-11-08 13:23
|
|
* @功能说明:桌号详情
|
|
*/
|
|
public function tableInfo(){
|
|
|
|
$input = $this->_input;
|
|
|
|
$dis = [
|
|
|
|
'id' => $input['id']
|
|
];
|
|
|
|
$table_model = new Table();
|
|
|
|
$res = $table_model->dataInfo($dis);
|
|
|
|
return $this->success($res);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-11-09 15:15
|
|
* @功能说明:刷新桌号码
|
|
*/
|
|
public function reTableQr(){
|
|
|
|
$input = $this->_input;
|
|
|
|
$qr_insert = [
|
|
|
|
'id' => $input['id']
|
|
];
|
|
|
|
$table_model = new Table();
|
|
|
|
$qr = $table_model->orderQr($qr_insert,$this->_uniacid);
|
|
|
|
if(!empty($qr)){
|
|
|
|
$table_model->dataUpdate(['id'=>$input['id']],['qr'=>$qr]);
|
|
|
|
}
|
|
|
|
return $this->success($qr);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-12-30 11:51
|
|
* @功能说明:关于我们列表
|
|
*/
|
|
public function aboutUsList(){
|
|
|
|
$input = $this->_param;
|
|
|
|
$dis[] = ['uniacid','=',$this->_uniacid];
|
|
|
|
$dis[] = ['status','>',-1];
|
|
|
|
$dis[] = ['type','=',0];
|
|
|
|
if(!empty($input['title'])){
|
|
|
|
$dis[] = ['title','like','%'.$input['title'].'%'];
|
|
}
|
|
|
|
$us_model = new AboutUs();
|
|
|
|
$data = $us_model->dataList($dis,$input['limit']);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-11-08 13:21
|
|
* @功能说明:添加我们列表
|
|
*/
|
|
public function aboutUsAdd(){
|
|
|
|
$input = $this->_input;
|
|
|
|
$input['uniacid'] = $this->_uniacid;
|
|
|
|
$us_model = new AboutUs();
|
|
|
|
$res = $us_model->dataAdd($input);
|
|
|
|
return $this->success($res);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-11-08 13:23
|
|
* @功能说明:编辑我们列表
|
|
*/
|
|
public function aboutUsUpdate(){
|
|
|
|
$input = $this->_input;
|
|
|
|
$dis = [
|
|
|
|
'id' => $input['id']
|
|
];
|
|
|
|
$us_model = new AboutUs();
|
|
|
|
$res = $us_model->dataUpdate($dis,$input);
|
|
|
|
return $this->success($res);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-11-08 13:23
|
|
* @功能说明:我们列表详情
|
|
*/
|
|
public function aboutUsInfo(){
|
|
|
|
$input = $this->_param;
|
|
|
|
$dis = [
|
|
|
|
'id' => $input['id'],
|
|
|
|
];
|
|
|
|
$us_model = new AboutUs();
|
|
|
|
$res = $us_model->dataInfo($dis);
|
|
|
|
return $this->success($res);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-11-08 13:23
|
|
* @功能说明:我们列表详情
|
|
*/
|
|
public function aboutUsInfoType(){
|
|
|
|
$input = $this->_param;
|
|
|
|
$input['type'] = !empty($input['type'])?$input['type']:0;
|
|
|
|
$dis = [
|
|
|
|
'type'=> $input['type'],
|
|
|
|
'uniacid' => $this->_uniacid
|
|
];
|
|
|
|
$us_model = new AboutUs();
|
|
|
|
$res = $us_model->dataInfo($dis);
|
|
|
|
if(!empty($input['type'])&&empty($res)){
|
|
|
|
$title = $input['type']==1?'动物认养协议':'土地租赁协议';
|
|
|
|
$dis['title'] = $title;
|
|
|
|
$us_model->dataAdd($dis);
|
|
|
|
$res = $us_model->dataInfo($dis);
|
|
}
|
|
|
|
return $this->success($res);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2022-01-11 10:48
|
|
* @功能说明:配送配置详情
|
|
*/
|
|
public function sendConfigInfo(){
|
|
|
|
$dis = [
|
|
|
|
'uniacid' => $this->_uniacid
|
|
];
|
|
|
|
$config = $this->model->dataInfo($dis);
|
|
|
|
$send_model = new SendConfig();
|
|
|
|
$send_config = $send_model->where($dis)->select()->toArray();
|
|
|
|
$config['send_time'] = $send_config;
|
|
|
|
return $this->success($config);
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2022-01-11 11:51
|
|
* @功能说明:编辑配送设置
|
|
*/
|
|
public function sendConfigUpdate(){
|
|
|
|
$input = $this->_input;
|
|
|
|
$dis = [
|
|
|
|
'uniacid' => $this->_uniacid
|
|
|
|
];
|
|
|
|
$update = [
|
|
|
|
'app_day' => $input['app_day'],
|
|
|
|
// 'start_distance' => $input['start_distance'],
|
|
|
|
// 'start_price' => $input['start_price'],
|
|
//
|
|
// 'renew_distance' => $input['renew_distance'],
|
|
//
|
|
// 'renew_price' => $input['renew_price'],
|
|
|
|
];
|
|
|
|
$res = $this->model->dataUpdate($dis,$update);
|
|
|
|
$send_model = new SendConfig();
|
|
|
|
$send_model->where($dis)->delete();
|
|
|
|
if(!empty($input['send_time'])){
|
|
|
|
foreach ($input['send_time'] as $key => $value){
|
|
|
|
$input['send_time'][$key]['uniacid'] = $this->_uniacid;
|
|
|
|
}
|
|
|
|
$send_model->saveAll($input['send_time']);
|
|
}
|
|
|
|
return $this->success($res);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-03-12 16:27
|
|
* @功能说明:公益栏目列表
|
|
*/
|
|
public function welfareList(){
|
|
|
|
$input = $this->_param;
|
|
|
|
$welfare_model = new WelfareColumn();
|
|
|
|
$dis[] = ['uniacid','=',$this->_uniacid];
|
|
|
|
$dis[] = ['status','>',-1];
|
|
|
|
if(!empty($input['title'])){
|
|
|
|
$dis[] = ['title','like','%'.$input['title'].'%'];
|
|
}
|
|
|
|
$type = !empty($input['type'])?$input['type']:1;
|
|
|
|
$dis[] = ['type','=',$type];
|
|
|
|
$data = $welfare_model->dataList($dis,$input['limit']);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-03-12 16:37
|
|
* @功能说明:添加公益栏目
|
|
*
|
|
*/
|
|
public function welfareAdd(){
|
|
|
|
$input = $this->_input;
|
|
|
|
$welfare_model = new WelfareColumn();
|
|
|
|
$input['uniacid'] = $this->_uniacid;
|
|
|
|
$res = $welfare_model->dataAdd($input);
|
|
|
|
return $this->success($res);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-03-19 13:35
|
|
* @功能说明:编辑公益栏目
|
|
*/
|
|
public function welfareUpdate(){
|
|
|
|
$input = $this->_input;
|
|
|
|
$welfare_model = new WelfareColumn();
|
|
|
|
$dis = [
|
|
|
|
'id' => $input['id']
|
|
];
|
|
|
|
$res = $welfare_model->dataUpdate($dis,$input);
|
|
|
|
return $this->success($res);
|
|
|
|
}
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-03-19 13:35
|
|
* @功能说明:公益栏目详情
|
|
*/
|
|
public function welfareInfo(){
|
|
|
|
$input = $this->_param;
|
|
|
|
$welfare_model = new WelfareColumn();
|
|
|
|
$dis = [
|
|
|
|
'id' => $input['id']
|
|
];
|
|
|
|
$res = $welfare_model->dataInfo($dis);
|
|
|
|
return $this->success($res);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|