IndexController.php
2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
// +----------------------------------------------------------------------
// | bronet [ 以客户为中心 以奋斗者为本 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.bronet.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
namespace app\portal\controller;
use app\portal\model\AskModel;
use cmf\controller\HomeBaseController;
use EasyWeChat\Foundation\Application;
use think\Loader;
class IndexController extends HomeBaseController
{
public function index()
{
header("Content-type: text/html; charset=utf-8");
$final['kuang1'] = 'Https://'.$_SERVER['HTTP_HOST'].'/themes/simpleboot3/public/assets/images/kuang1@2x.png';
$final['logo'] = 'Https://'.$_SERVER['HTTP_HOST'].'/themes/simpleboot3/public/assets/images/logo@2x.png';
$final['fanhui'] = 'Https://'.$_SERVER['HTTP_HOST'].'/themes/simpleboot3/public/assets/images/fanhui@2x.png';
$final['top'] = 'Https://'.$_SERVER['HTTP_HOST'].'/themes/simpleboot3/public/assets/images/top@2x.png';
$final['bottom'] = 'Https://'.$_SERVER['HTTP_HOST'].'/themes/simpleboot3/public/assets/images/bottom@2x.png';
$this->apiResponse('1','成功',$final);
}
public function submit()
{
return $this->fetch('bingo/index');
}
public function insert()
{
$data = $this->request->param();
$validate = Loader::validate('Ask');
if(!$validate->scene('edit')->check($data)){
$mes = $validate->getError();
$this->apiResponse('0',$mes);
}
$model = new AskModel();
$isSet = $model->where($data)->find();
if($isSet){
$this->apiResponse('0','请勿重复提交');
}
$res = $model->save($data);
if($res){
$this->apiResponse('1','提交成功');
}else{
$this->apiResponse('0','提交失败');
}
}
}