Commit 8b61616a by LiuJunYi

初始化

parent 57abc3f2

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

File deleted
.ftpconfig
.ftpconfig.cson
.ftpignore
id_rsa
.DS_Store
.git
.idea
composer.lock
*.log
sftp-config.json
.vscode
logs
runtime/*
*.yml
/vendor
/thinkphp
\ No newline at end of file
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Maveler管理系统
===============
## 部署
1. php版本 >= 7.0
2. 确保`runtime`、`logs`的权限。
```
chmod -R 777 runtime logs
```
## 数据库
```
根目录下的.sql文件: maveler.sql
```
数据库`CHARSET`编码设置为`utf8mb4`,`COLLATE`设置为`utf8mb4_unicode_ci`。
##### JSSDK分享配置
1. 先登录微信公众平台进入“公众号设置”的“功能设置”里填写“JS接口安全域名”,添加群空间的域名。
2. 确保`public/qunstatic/jssdk/access_token.json`、`public/qunstatic/jssdk/jsapi_ticket.json`的读写权限。
```php
chmod 777 public/qunstatic/jssdk/access_token.json public/qunstatic/jssdk/jsapi_ticket.json
```
##### 登录验证码显示
安装`think-captcha`:
```
composer require topthink/think-captcha
```
1. 若出现redeclear check_captcha() 的错误,需要把 public/index.php 中的 require __DIR__ . '/../vendor/autoload.php'; 注释掉!
```
// require __DIR__ . '/../vendor/autoload.php';
```
2. 在 login.html 中添加如下代码
```
<div id="captcha_div">
<input type="captcha" class="form-control" name="captcha" placeholder="验证码">
{:captcha_img()}
</div>
```
3. 在 admin/Login/login 控制器中添加如下代码
```
$captcha = input("post.captcha");
if(!captcha_check($captcha)){
//验证失败
$this->error('登录失败,验证码不正确!');
};
```
-----BEGIN CERTIFICATE-----
MIIFizCCBHOgAwIBAgIQBRuGSHbKF1m62w0FiPW5KzANBgkqhkiG9w0BAQsFADBy
MQswCQYDVQQGEwJDTjElMCMGA1UEChMcVHJ1c3RBc2lhIFRlY2hub2xvZ2llcywg
SW5jLjEdMBsGA1UECxMURG9tYWluIFZhbGlkYXRlZCBTU0wxHTAbBgNVBAMTFFRy
dXN0QXNpYSBUTFMgUlNBIENBMB4XDTE4MDkyOTAwMDAwMFoXDTE5MDkyOTEyMDAw
MFowGjEYMBYGA1UEAxMPYXBwLm1hdmVsZXIuY29tMIIBIjANBgkqhkiG9w0BAQEF
AAOCAQ8AMIIBCgKCAQEAo6NpLGqv4ugmcuSeA67V9CyoaBRomKdhYkZvk0EN0U9Z
fOCqBLtxhexT13dIVEUAatbJbOdIvB0tGFyH2s9exDBx5UaTNRXZonn60puZddK8
6PhUSuZuWFdHIBdnarJFGYyEYapPQ/d5AfiMOcJbbJznmAXTcCQZwWvqvRxWwU7z
+Qa/GKgZdqLa+PlkNVlDPefQZ/yFiP7K/nR7ib0+y3jQtpH9xuICUT+o5csfCDGz
DoHsV2NYHwuWik6UOKUG+ZMrchRNDHmoC47YeV9ABxxx3YXgnPIEd7W/K+q1uAPS
KKsIBaSCx6u0nJrJAwJWkdv+YVLYYJuWEdpE029MEwIDAQABo4ICczCCAm8wHwYD
VR0jBBgwFoAUf9OZ86BHDjEAVlYijrfMnt3KAYowHQYDVR0OBBYEFEnJRMN6T2is
PCy0jsX4NupdNoT1MBoGA1UdEQQTMBGCD2FwcC5tYXZlbGVyLmNvbTAOBgNVHQ8B
Af8EBAMCBaAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMEwGA1UdIARF
MEMwNwYJYIZIAYb9bAECMCowKAYIKwYBBQUHAgEWHGh0dHBzOi8vd3d3LmRpZ2lj
ZXJ0LmNvbS9DUFMwCAYGZ4EMAQIBMIGBBggrBgEFBQcBAQR1MHMwJQYIKwYBBQUH
MAGGGWh0dHA6Ly9vY3NwMi5kaWdpY2VydC5jb20wSgYIKwYBBQUHMAKGPmh0dHA6
Ly9jYWNlcnRzLmRpZ2l0YWxjZXJ0dmFsaWRhdGlvbi5jb20vVHJ1c3RBc2lhVExT
UlNBQ0EuY3J0MAkGA1UdEwQCMAAwggEDBgorBgEEAdZ5AgQCBIH0BIHxAO8AdgCk
uQmQtBhYFIe7E6LMZ3AKPDWYBPkb37jjd80OyA3cEAAAAWYl5h4PAAAEAwBHMEUC
IAqABS/+KKuTvrfmCd+ONrbwtPbqSvLXkJAR8CDll+56AiEAsKxcNTs3DfexqxtE
Y74uokwy4ek9Zbb3eJUnLmKO9NMAdQCHdb/nWXz4jEOZX73zbv9WjUdWNv9KtWDB
tOr/XqCDDwAAAWYl5h7yAAAEAwBGMEQCIF0nbhRb1Ggt98q4/q8a+NvfWJofbmii
rxnGB4JHo4IrAiAqLqgXAIdCZMhhEpnnSyproxJQnzr3Pav/GpCmjhEi6zANBgkq
hkiG9w0BAQsFAAOCAQEAL5AowXwgNIZBCTxaW/CQjFRcitsLlxxkHBClXqzkQG9M
JIPc6SWqTLmfJvZc+IythbUoXmneFfj+sJGUryxmldh+yxelC4MjkMD9kF6GxAak
hQ/Mi71nOss1Te87G+M+DEMclKXH5YQNoUSoCJtMCeVXhtbesV3Q7IIlIbApfWGb
BP4pWmCqS45tkLbAUAmq+kN7ZE5UoXgc0525A0pRkZOXllOGfu7xSDy5/iB6pbSr
rD/WpMG4zLTrLtCXN60hIcgCoHc9E2eKcYTdTGqM04HzIe96SRRNye1RcALWhVk0
hUDgxTrtq9WGFyHNjFFrY8qB6zeMesQJ0AXxaps7QQ==
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIErjCCA5agAwIBAgIQBYAmfwbylVM0jhwYWl7uLjANBgkqhkiG9w0BAQsFADBh
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD
QTAeFw0xNzEyMDgxMjI4MjZaFw0yNzEyMDgxMjI4MjZaMHIxCzAJBgNVBAYTAkNO
MSUwIwYDVQQKExxUcnVzdEFzaWEgVGVjaG5vbG9naWVzLCBJbmMuMR0wGwYDVQQL
ExREb21haW4gVmFsaWRhdGVkIFNTTDEdMBsGA1UEAxMUVHJ1c3RBc2lhIFRMUyBS
U0EgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCgWa9X+ph+wAm8
Yh1Fk1MjKbQ5QwBOOKVaZR/OfCh+F6f93u7vZHGcUU/lvVGgUQnbzJhR1UV2epJa
e+m7cxnXIKdD0/VS9btAgwJszGFvwoqXeaCqFoP71wPmXjjUwLT70+qvX4hdyYfO
JcjeTz5QKtg8zQwxaK9x4JT9CoOmoVdVhEBAiD3DwR5fFgOHDwwGxdJWVBvktnoA
zjdTLXDdbSVC5jZ0u8oq9BiTDv7jAlsB5F8aZgvSZDOQeFrwaOTbKWSEInEhnchK
ZTD1dz6aBlk1xGEI5PZWAnVAba/ofH33ktymaTDsE6xRDnW97pDkimCRak6CEbfe
3dXw6OV5AgMBAAGjggFPMIIBSzAdBgNVHQ4EFgQUf9OZ86BHDjEAVlYijrfMnt3K
AYowHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDgYDVR0PAQH/BAQD
AgGGMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjASBgNVHRMBAf8ECDAG
AQH/AgEAMDQGCCsGAQUFBwEBBCgwJjAkBggrBgEFBQcwAYYYaHR0cDovL29jc3Au
ZGlnaWNlcnQuY29tMEIGA1UdHwQ7MDkwN6A1oDOGMWh0dHA6Ly9jcmwzLmRpZ2lj
ZXJ0LmNvbS9EaWdpQ2VydEdsb2JhbFJvb3RDQS5jcmwwTAYDVR0gBEUwQzA3Bglg
hkgBhv1sAQIwKjAoBggrBgEFBQcCARYcaHR0cHM6Ly93d3cuZGlnaWNlcnQuY29t
L0NQUzAIBgZngQwBAgEwDQYJKoZIhvcNAQELBQADggEBAK3dVOj5dlv4MzK2i233
lDYvyJ3slFY2X2HKTYGte8nbK6i5/fsDImMYihAkp6VaNY/en8WZ5qcrQPVLuJrJ
DSXT04NnMeZOQDUoj/NHAmdfCBB/h1bZ5OGK6Sf1h5Yx/5wR4f3TUoPgGlnU7EuP
ISLNdMRiDrXntcImDAiRvkh5GJuH4YCVE6XEntqaNIgGkRwxKSgnU3Id3iuFbW9F
UQ9Qqtb1GX91AJ7i4153TikGgYCdwYkBURD8gSVe8OAco6IfZOYt/TEwii1Ivi1C
qnuUlWpsF1LdQNIdfbW3TSe0BhQa7ifbVIfvPWHYOu3rkg1ZeMo6XRU9B4n5VyJY
RmE=
-----END CERTIFICATE-----
\ No newline at end of file
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAo6NpLGqv4ugmcuSeA67V9CyoaBRomKdhYkZvk0EN0U9ZfOCq
BLtxhexT13dIVEUAatbJbOdIvB0tGFyH2s9exDBx5UaTNRXZonn60puZddK86PhU
SuZuWFdHIBdnarJFGYyEYapPQ/d5AfiMOcJbbJznmAXTcCQZwWvqvRxWwU7z+Qa/
GKgZdqLa+PlkNVlDPefQZ/yFiP7K/nR7ib0+y3jQtpH9xuICUT+o5csfCDGzDoHs
V2NYHwuWik6UOKUG+ZMrchRNDHmoC47YeV9ABxxx3YXgnPIEd7W/K+q1uAPSKKsI
BaSCx6u0nJrJAwJWkdv+YVLYYJuWEdpE029MEwIDAQABAoIBAB90/fZmafp2Q1Hp
5gByPzoJzbP4XGUgJCXmwXMu2c+nb94EOFrhh8DFfhaZHSPqAdsIAD+5tG9JMo6Q
1yL2o1KWt4ZqS0k0spo71b5f4B/Yy60Dc/zUEFlWKdue9Cf8LjFrpFU8DrHTpIT+
+UHvPXEDNrgwQoW3wuW+b6k8BedyDboE2Yv3bwN2bu2I9pH4Yu60YdY4qWb7dbVj
piOOOB03ywCxhoKOqkR6emrjMdEP19eGfcOCo3oKPsl6RUrQBaT+CrMgfIw1pfk4
JKyP/5oV97EjizINd7nVgC2htd4X9DtF/+vu2yQoRsxrpNdEKFZb0gsLiKVRNcZe
wtmukC0CgYEA2VfD1vfMJzDTZBDHTQqicFobm5GCmGull/5Q+zKe3isiVw+6flku
l98qrNnvgAAmdFnQFsA4vBpjW00NDH4F2aoX0DnoE3gHxDrJY2pliMahYFCsOusQ
yJ75X0xrC7MQc5hMIWmJYxQ4SVhGGdJUky76k9cWDWftS/zAVr7p87UCgYEAwL5T
z8ImCxCnmV7DrieykZmnejUv8GS0Wa64RdM3DXAhefokfu3TBEtwUHpn6mm35Q6k
3UgSw6s29jVHfRRmFtOEQz+qwNXMvxw/RFZgQbrqsK7kL7xpkHkI5h+xAs+f8IRb
YasYrHyrjbcb2r9lPU4hd2e7lcRPK49yUSagracCgYEAxcUSBKOZlrPcN3r5EAa0
R04HPylKT83scgFNyTaHz5wqdFRwnBYkyrecyorJX41DcK5lJr6lIa1VabgUPqDS
S/12C9kVb9nSH2Jq7NbdK3erUsw13KsXq6bVPj14Tr4TI0ybQfAZvxmgGkWEDG0S
3pdqFmsquuotyO5mSskQc90CgYBN2FD3Vx2QWICoU/rKSuQ3JAzdMcAT4kho9EUe
hmj0t3X90saMsTcJxAIvrtBrf5kzHQ//A0340xzWobwmy2dUDsebdYpcab1Q7nKr
AgvMYFbLV0d39Cvamte6QdB3Jy4csQhLURQdDhknmm3YknasJPMlS7MakPe8yynL
lsNMfwKBgA2LRfcaxvDZWcodukgbvpxI/3bjR6JYZ6FJrLgAfUONB2esGMvOCS2u
H2UBCb6K6VlaGCyYAIutmil+Y5eu33ctB9EUVDio51MtJkEDpT8Vj+IpEOuaFu/y
qwlNqxeKO4z1LtCKF86oQQ/ZlFhE0JsGc8x44yD7nY8NzL11LzMC
-----END RSA PRIVATE KEY-----
\ No newline at end of file
deny from all
\ No newline at end of file
<?php
namespace app\admin\behavior;
use think\Controller;
/**
* 检测用户
*/
class UserCheck
{
//类里面引入jump;类
use \traits\controller\Jump;
// 绑定到CheckAuth标签,可以用于检测Session以用来判断用户是否登录
public function run(&$params){
// 网站session会话判断
if (!session('?uid')) {
return $this->error('请登录!', 'Login/login');
}
}
}
\ No newline at end of file
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
$config = [
];
return $config;
<?php
namespace app\admin\controller;
use app\common\model\Admin as AmdinModel;
use app\admin\controller\AuthBase;
class Admin extends AuthBase
{
/**
* 显示资源列表
*
* @return \think\Response
*/
public function index()
{
$keyword = trim(input('get.word'));
$map = array();
if ($keyword) {
$map['name'] = ['like', "%" . $keyword . "%"];
}
$admins = AmdinModel::where($map)
->order('id', 'desc')->paginate(20, false, [
'query' => [
'k' => $keyword
]
]);
$this->assign('admins', $admins);
return $this->fetch();
}
/**
* 显示指定的资源
*
* @param int $id
* @return \think\Response
*/
public function read($id)
{
$admin = AmdinModel::get(trim($id));
if ($admin) {
$data['user'] = $admin;
return json_encode(['error' => 0, 'msg' => '获取成功', 'data' => $data]);
} else {
return json_encode(['error' => 1, 'msg' => '获取失败']);
}
}
/**
* 更新
*
* @param int $id
* @return \think\Response
*/
public function update($id)
{
if (request()->isPost()) {
$admin = AmdinModel::get(trim($id));
if ($admin) {
$name = input("post.name");
$password = input("post.password");
$update = false;
if ($name != $admin->name) {
$admin->name = $name;
$update = true;
}
if ($password && md5($password) != $admin->password) {
$admin->password = md5($password);
$update = true;
}
if ($update && $admin->save()) {
// 更改当前管理员的session名称
if (session("uid") == $admin->id) {
session('username', $admin->name);
}
return json_encode(['error' => 0, 'msg' => '更新成功']);
} else {
return json_encode(['error' => 1, 'msg' => '没有任何修改']);
}
} else {
return json_encode(['error' => 1, 'msg' => '未找到对象']);
}
} else {
return json_encode(['error' => 1, 'msg' => '请求方法错误']);
}
}
}
<?php
namespace app\admin\controller;
use think\Controller;
use think\Request;
use think\Hook;
use app\admin\controller\Base;
/**
* 基础控制器
*/
class AuthBase extends Base
{
public function _initialize()
{
parent::_initialize();
Hook::listen('CheckAuth', $params);
}
}
\ No newline at end of file
<?php
namespace app\admin\controller;
use app\admin\controller\AuthBase;
use app\common\model\Admin as AdminModel;
use app\admin\controller\Upload;
class Banner extends AuthBase
{
public function _initialize()
{
parent::_initialize();
}
public function index()
{
$status = input('get.status');
$condition = [];
if ($status) {
$condition['status'] = $status;
}
$banner_model = model('banner');
$banner_list = $banner_model->where($condition)->order('created_at', 'desc')->paginate(10, false, ['query' => ['status' => $status]]);
$this->assign('banner_list', $banner_list);
return $this->fetch();
}
//新建banner
public function create()
{
if (request()->isPost()) {
$data = input('post.');
$banner_model = model('banner');
$upload = new Upload();
$result = $upload->sava(input('file.image'));
if (!$result['error']) {
$image = $result['result']['url'];
$data['image'] = $image;
}
$res = $banner_model->data($data)->save();
if ($res) {
$this->success('添加成功', url('admin/banner/index'), '', 1);
} else {
$this->error('添加失败', $_SERVER['HTTP_REFERER'], '', 1);
}
} else {
$this->assign('banner_info', 0);
return $this->fetch('update');
}
}
//更新banner
public function update($id)
{
$banner_model = model('banner');
if (request()->isPost()) {
$data = input('post.');
if (input('file.image')) {
$banner_info = ($banner_model->find('id'));
$old_image = $banner_info['image'];
$upload = new Upload();
$result = $upload->sava(input('file.image'));
if (!$result['error']) {
$image = $result['result']['url'];
$data['image'] = $image;
}
}
$res = $banner_model->save($data, ['id' => $id]);
if ($res) {
$this->success('修改成功', url('admin/banner/index'), '', 1);
} else {
$this->error('修改失败', $_SERVER['HTTP_REFERER'], '', 1);
}
} else {
$banner_info = $banner_model->find($id);
$this->assign('banner_info', $banner_info);
return $this->fetch();
}
}
//删除banner
public function delete()
{
$id = input('post.id');
$res = model('banner')->destroy($id);
$banner_info = model('banner')->find($id);
$old_image = $banner_info['image'];
model('resource')->where('address', $old_image)->delete();
if ($res) {
$this->success('删除成功', '', '', 1);
} else {
$this->error('删除失败', '', '', 1);
}
}
}
<?php
namespace app\admin\controller;
use think\Controller;
use think\Request;
/**
* 基础控制器
*/
class Base extends Controller
{
public function _initialize()
{
define('CONTROLLER_NAME',Request::instance()->controller());
define('MODULE_NAME',Request::instance()->module());
define('ACTION_NAME',Request::instance()->action());
}
}
\ No newline at end of file
<?php
namespace app\admin\controller;
class Business extends AuthBase
{
//商家入住
public function index()
{
$where = [];
if(input('business_name')){
$where['business_name'] = input('business_name');
}
$business = \app\common\model\Business::where($where)->order('id','desc')->paginate('15');
$this->assign(compact('business'));
return $this->fetch();
}
}
\ No newline at end of file
<?php
namespace app\admin\controller;
use think\Db;
use app\admin\controller\AuthBase;
use app\common\model\Post as PostModel;
use app\common\model\Admin as AdminModel;
use app\admin\controller\Upload;
class Guide extends AuthBase
{
public function index()
{
$title = input('title');
$map = array();
if (input('order') == 2) {
$order = ['sort' => 'desc', 'id' => 'desc'];
} else {
$order = ['id' => 'desc'];
}
// 模糊查询title
if ($title) {
$map['title'] = ['like', "%" . $title . "%"];
}
$posts = model('guide')->where($map)->order($order)->paginate(10);
$this->assign('articles', $posts);
return view("index");
}
//新建攻略
public function create()
{
$tag_model = model("tags");
//反显数据处理,新建则设为空
$tag_list = $tag_model->order('sort', 'asc')->select();
$this->assign('tag_list', $tag_list);
$this->assign('article', 0);
$this->assign('tag_arr', []);
$this->assign('tags', '');
if (request()->isPost()) {
$type = input("post.type");
$data = array(
'title' => input("post.title"),
'tags' => input("post.tags/a"),
'poster' => input('file.poster')
);
if ($type == 1) {
$data['content'] = input("post.content");
} else {
$data['content'] = input("post.href");
}
$validate = validate('Post');
if (!$validate->scene('create')->check($data)) {
$msg = $validate->getError();
$this->assign('msg', $msg);
return view();
}
//上传封面到七牛云
$upload = new Upload();
$result = $upload->sava(input('file.poster'));
if ($result['error']) {
$this->assign('msg', $result['error']);
return view();
}
$article = new PostModel([
'admin_id' => intval(session('uid')),
'poster' => $result['result']['url'],
'tags' => $data['tags'],
'title' => $data['title'],
'type' => $type,
'intro' => input('post.intro'),
'content' => htmlspecialchars_decode($data['content'])
]);
if ($article->save()) {
$this->success('添加成功', url('@admin/Guide/index'), '', 1);
} else {
$this->error('添加失败', $_SERVER['HTTP_REFERER'], '', 1);
}
} else {
return view('update');
}
}
/**
* 修改攻略
*
* @return \think\Response
*/
public function update($id)
{
//反显数据处理
$tag_model = model("tags");
$tag_list = $tag_model->order('sort', 'asc')->select();
$this->assign('tag_list', $tag_list);
$article = PostModel::get($id);
$tags = $article['tags'];
$this->assign('tags', $tags);
if ($tags != '') {
$tag_arr = explode(',', $tags);
} else {
$tag_arr = [];
}
$this->assign('tag_arr', $tag_arr);
if (request()->isPost()) {
$type = input("post.type");
$data = array(
'title' => input("post.title"),
'tags' => input("post.tags/a")
);
if ($type == 1) {
$data['content'] = input("post.content");
} else {
$data['content'] = input("post.href");
}
$validate = validate('Post');
if (!$validate->scene('update')->check($data)) {
$msg = $validate->getError();
$this->assign('msg', $msg);
return view();
}
$condition = [
'tags' => implode(',',$data['tags']),
'title' => $data['title'],
'intro' => input('post.intro'),
'type' => $type,
'content' => htmlspecialchars_decode($data['content'])
];
if (input('file.poster')) {
//上传封面到七牛云
$upload = new Upload();
$result = $upload->sava(input('file.poster'));
if ($result['error']) {
$this->assign('msg', $result['error']);
return view();
}
$condition['poster'] = $result['result']['url'];
}
$res = model('post')->save($condition, ['id' => $id]);
if ($res) {
$this->success('修改成功', url('@admin/Guide/index'), '', 1);
} else {
$this->success('修改失败', $_SERVER['HTTP_REFERER'], '', 1);
}
} else {
$this->assign('article', $article);
return view();
}
}
/**
* 删除攻略
*
* @return \think\Response
*/
public function delete()
{
$result["error"] = 0;
$result["msg"] = '删除成功';
if (request()->isPost()) {
$id = input("post.id");
$article = PostModel::get($id);
if ($article) {
if ($article->delete()) {
} else {
$result["error"] = 1;
$result["msg"] = '删除失败!';
}
} else {
$result["error"] = 1;
$result["msg"] = '删除对象不存在';
}
} else {
$result["error"] = 1;
$result["msg"] = '不支持的请求方法';
}
echo json_encode($result);
}
//修改排序
public function changeSort()
{
if(request()->isPost()){
$res = \app\common\model\Guide::update(input('post.'));
if($res){
return json(['code'=>0,'msg'=>'修改成功']);
}else{
return json(['code'=>1,'msg'=>'修改失败']);
}
}
}
}
<?php
namespace app\admin\controller;
use app\admin\controller\AuthBase;
use app\common\model\Visitor as VisitorModel;
use app\common\model\HomeView as HomeViewModel;
use app\common\model\MiniappView as MiniappViewModel;
use app\common\model\ExpbtnClick as ExpbtnClickModel;
class Index extends AuthBase
{
public function _initialize()
{
parent::_initialize();
}
public function index(){
$user_model = model('user');
$order_model = model('order');
$comment_model = model('comment');
$refund_model = model('refund');
//统计用户总数
$user_num = $user_model->count();
$this->assign('user_num',$user_num);
//统计今日新增用户数
$user_num_today = $user_model->where('created_at','>',date('Y-m-d',time()).' 00:00:00')->count();
$this->assign('user_num_today',$user_num_today);
//统计订单总数
$order_num = $order_model->count();
$this->assign('order_num',$order_num);
//统计今日订单总数
$order_num_today = $order_model->where('created_at','>',date('Y-m-d',time()).' 00:00:00')->count();
$this->assign('order_num_today',$order_num_today);
//统计待审核退款
$wait_num_r = $refund_model->where('status',1)->count();
$this->assign('wait_num_r',$wait_num_r);
//统计待审核评论
$wait_num_c = $comment_model->where('status',1)->count();
$this->assign('wait_num_c',$wait_num_c);
return view("index");
}
}
\ No newline at end of file
<?php
namespace app\admin\controller;
use app\admin\controller\AuthBase;
use app\common\model\Log as LogModel;
use app\common\model\Admin as AdminModel;
class Log extends AuthBase
{
/**
* 显示资源列表
*
* @return \think\Response
*/
public function index()
{
$level = input('level');
$category = input('category');
$admin = input('admin');
$map = [];
if ($admin) {
$uids = AdminModel::where('username','like','%'.$admin.'%')
->field('id')
->select();
if ($uids) {
$in_uids = [];
foreach ($uids as $key => $value) {
$in_uids = $value['id'];
}
$map['user_id'] = ['in', $in_uids];
}
}
if ($level != null) {
$map['level'] = $level;
}
if ($category != null) {
$map['category'] = ['like', "%$category%"];
}
$items = LogModel::where($map)
->with('admin')
->order('id', 'desc')
->paginate(15, false)
->each(function($item, $key){
// 拼接字符串
$item['visitor'] = 'IP:'.$item['ip'].'<br/>'.'OS:'.$item['os'].'<br/>'.'Browser:'.$item['browser'];
});
$this->assign('items', $items);
return view();
}
}
\ No newline at end of file
<?php
namespace app\admin\controller;
use app\admin\controller\Base;
use app\common\model\Admin as AmdinModel;
class Login extends Base
{
/**
* 用户登录
*/
public function login()
{
// 已登录
$uid = session('uid');
if (session('uid')) {
$this->redirect(url('@admin/Index/index/tab/index'));
}
// 判断提交方式
if (request()->isPost()) {
$username = input("post.username");
$password = input("post.password");
$captcha = input("post.captcha");
if(!captcha_check($captcha)){
//验证失败
$this->error('登录失败,验证码不正确!');
};
$admin = AmdinModel::get(['username' => $username]);
if ($admin && $admin->password == md5($password)) {
session('uid', $admin['id']); // 当前用户id
session('username', $admin['username']); // 当前用户昵称
$admin->is_login = 1;
$admin->save();
$this->success('登录成功,正跳转至系统首页...', url('@admin/Index/index/tab/index'));
}else{
$this->error('登录失败,用户名或密码不正确!');
}
}else{
return view("admin/login");
}
}
/**
* 用户注销
*/
public function logout()
{
$uid = session('uid');
if ($uid && AmdinModel::get(intval($uid))) {
$admin = AmdinModel::get(intval($uid));
$admin->is_login = 0;
$admin->save();
}
// 清除所有session
session(null);
$this->redirect(url('@admin/Login/login'));
}
}
<?php
namespace app\admin\controller;
use app\admin\controller\AuthBase;
class Project extends AuthBase
{
public function _initialize()
{
parent::_initialize();
}
public function index(){
$order_list = model('order')->order('id desc')->paginate(10);
$this->assign("order_list",$order_list);
$this->fetch();
}
}
<?php
/**
* Created by PhpStorm.
* User: wanggang
* Date: 2018/9/29
* Time: 下午8:23
*/
namespace app\admin\controller;
use PHPExcel_IOFactory,PHPExcel;
class OutputExcel
{
/*存储excel类对象*/
private static $obpe;
/*初始化*/
public function __construct(){self::$obpe = new PHPExcel();}
/**
* 导出
* @param array $mulit_arr
* @param string $filename
* @param string $Title
* @param string $Subject
* @param string $Description
* @param string $Keywords
* @param string $Category
* @param string $type
*/
public function export($mulit_arr = [],$filename = 'mulit_sheet',$Title='',$Subject='',$Description='',$Keywords='',$Category='',$type = 'output')
{
/* @func 设置文档基本属性 */
$obpe_pro = self::$obpe->getProperties();
$obpe_pro->setCreator('美行者')/*设置创建者*/
->setLastModifiedBy(date('Y/m/d H:i'))/*设置时间 2013/2/16 15:00*/
->setTitle($Title)/*设置标题*/
->setSubject($Subject)/*设置备注*/
->setDescription($Description)/*设置描述*/
->setKeywords($Keywords)/*设置关键字 | 标记*/
->setCategory($Category);/*设置类别*/
self::$obpe->getActiveSheet()->getColumnDimension('A')->setAutoSize(true);
self::$obpe->getActiveSheet()->getColumnDimension('B')->setAutoSize(true);
self::$obpe->getActiveSheet()->getColumnDimension('C')->setAutoSize(true);
self::$obpe->getActiveSheet()->getColumnDimension('D')->setAutoSize(true);
self::$obpe->getActiveSheet()->getColumnDimension('E')->setAutoSize(true);
self::$obpe->getActiveSheet()->getColumnDimension('F')->setAutoSize(true);
self::$obpe->getActiveSheet()->getColumnDimension('G')->setAutoSize(true);
self::$obpe->getActiveSheet()->getColumnDimension('H')->setAutoSize(true);
self::$obpe->getActiveSheet()->getColumnDimension('I')->setAutoSize(true);
self::$obpe->getActiveSheet()->getColumnDimension('J')->setAutoSize(true);
self::$obpe->getActiveSheet()->getColumnDimension('K')->setAutoSize(true);
self::$obpe->getActiveSheet()->getColumnDimension('L')->setAutoSize(true);
self::$obpe->getActiveSheet()->getColumnDimension('M')->setAutoSize(true);
self::$obpe->getActiveSheet()->getColumnDimension('N')->setAutoSize(true);
self::$obpe->getActiveSheet()->getColumnDimension('O')->setAutoSize(true);
self::$obpe->getActiveSheet()->getColumnDimension('p')->setAutoSize(true);
self::$obpe->getActiveSheet()->getColumnDimension('Q')->setAutoSize(true);
/*
* 设置宽度
$obpe->getActiveSheet()->getColumnDimension()->setAutoSize(true);
$obpe->getActiveSheet()->getColumnDimension('B')->setWidth(10);
设置当前sheet索引,用于后续的内容操作
一般用在对个Sheet的时候才需要显示调用
缺省情况下,PHPExcel会自动创建第一个SHEET被设置SheetIndex=0
*/
/*$mulit_arr*/
foreach ($mulit_arr['data'] as $key=>$value)
{
/*下面这一块可以封装后 实现多个工作空间的布局发生变化*/
$next_key = $key+1;
/*设置SHEET*/
self::$obpe->setactivesheetindex($key);
/*设置工作空间名称*/
$sheet = self::$obpe->getActiveSheet();
$sheet->setTitle($mulit_arr['sheet'][$key]['title']);
/*写入数据*/
foreach ($value as $k=>$v)
{
/* @func 设置列 */
$kkup = $k+1;
foreach ($v as $kk=>$vv)
{
$where = self::getLetterByNumber($kk);/*X轴 改变这个位置可以改变文档布局*/
$x = $where.$kkup;
self::$obpe->getactivesheet()->setcellvalue($x,$vv);
}
}
/*是否需要创建下一个工作空间*/
if(isset($mulit_arr['data'][$next_key])) self::$obpe->createSheet();
}
/*写入内容*/
$obwrite = PHPExcel_IOFactory::createWriter(self::$obpe, 'Excel5');
$filename = $filename.'.xls';
if($type == 'output')
{
/**直接在浏览器输出*/
header('Pragma: public');
header('Expires: 0');
header('Cache-Control:must-revalidate,post-check=0,pre-check=0');
header('Content-Type:application/force-download');
header('Content-Type:application/vnd.ms-execl');
header('Content-Type:application/octet-stream');
header('Content-Type:application/download');
header("Content-Disposition:attachment;filename='$filename'");
header('Content-Transfer-Encoding:binary');
$obwrite->save('php://output');
}else if($type == 'put') {
/*ob_end_clean();*/
/*保存文件*/
$obwrite->save($filename);
}
}
/**
* 确定文件X横轴 # 这里暂时就弄这么多吧
* @param int $number 传进来的就是$model的key
* @return mixed
*/
protected static function getLetterByNumber($number = 1)
{
return ['A','B','C','D','E','F','G','H','I','J','K','L','M', 'N','O','P','Q','R','S','T','U','V','W','X','Y','Z'][$number];
}
}
<?php
namespace app\admin\controller;
use think\Db;
use app\admin\controller\AuthBase;
use app\common\model\Post as PostModel;
use app\common\model\Admin as AdminModel;
use app\admin\controller\Upload;
class Post extends AuthBase
{
public function index()
{
$title = input('title');
$map = array();
// 模糊查询title
if ($title) {
$map['title'] = ['like', "%".$title."%"];
}
$posts = PostModel::where($map)->order('id desc')->paginate(10);
$this->assign('articles', $posts);
return view("index");
}
public function create()
{
$tag_model = model("tags");
$tag_list = $tag_model -> order('sort','asc') -> select();
$this -> assign('tag_list', $tag_list);
if (request()->isPost()) {
$type = input("post.type");
$data = array(
'title' => input("post.title"),
'tags' => input("post.tags"),
'poster' => input('file.poster')
);
if($type == 1){
$data['content'] =input("post.content");
}else{
$data['content'] =input("post.href");
}
$validate = validate('Post');
if (!$validate->scene('create')->check($data)) {
$msg = $validate->getError();
$this->assign('msg', $msg);
return view();
}
// 上传封面到七牛云
$upload = new Upload();
$result = $upload -> sava(input('file.poster'));
if($result['error']){
$this->assign('msg', $result['error']);
return view();
}
$article = new PostModel([
'admin_id' => intval(session('uid')),
'poster' => $result['result']['url'],
'tags' => $data['tags'],
'title' => $data['title'],
'type' => $type,
'content' => htmlspecialchars($data['content'])
]);
if ($article->save()) {
$this->redirect(url('@admin/Post/index'));
} else {
return view();
}
} else {
return view();
}
}
/**
* 修改文章
*
* @return \think\Response
*/
public function update($id)
{
$article = PostModel::get($id);
if (request()->isPost()) {
if (!$article) {
$this->error('文章不存在!');
echo "404";
}
$data = input("post.");
if (!trim(input("post.title")) || !trim(input("post.content")) ) {
$msg = "标题和内容不为空!";
$this->assign('msg', $msg);
$this->assign('article', $article);
return view();
}
$article->title = $data['title'];
$article->content = htmlspecialchars($data['content']);
$article->admin_id = intval(session('uid'));
if ($article->save()) {
$this->redirect(url('@admin/Post/index'));
} else {
$this->assign('article', $article);
return view();
}
}else{
$this->assign('article', $article);
return view();
}
}
/**
* 删除文章
*
* @return \think\Response
*/
public function delete()
{
$result["error"] = 0;
$result["msg"] = '删除成功';
if( request()->isPost() ) {
$id = input("post.id");
$article = PostModel::get($id);
if( $article ) {
if( $article->delete() ){
}else{
$result["error"] = 1;
$result["msg"] = '删除失败!';
}
}else{
$result["error"] = 1;
$result["msg"] = '删除对象不存在';
}
}else{
$result["error"] = 1;
$result["msg"] = '不支持的请求方法';
}
echo json_encode($result);
}
}
<?php
namespace app\admin\controller;
use app\common\model\Region as RegionModel;
class Region extends AuthBase
{
private $model;
public function _initialize()
{
parent::_initialize();
$this->model = new RegionModel();
}
/**
* 新增页
* @return mixed
*/
public function index()
{
$list = $this->model->select();
foreach ($list as &$v) {
$v['pid'] = (int)$v['pid'];
$v['id'] = (int)$v['id'];
}
return $this->fetch('', compact('list'));
}
/**
* 新增分类
* @return \think\response\Json
*/
public function add()
{
if (request()->isAjax()) {
$res = $this->model->add(input('post.'));
if ($res) {
return json(['code' => 0, 'msg' => '新增成功']);
} else {
return json(['code' => 1, 'msg' => $res->getError() ?: '新增失败']);
}
}
return json(['code' => 1, 'msg' => '访问失败']);
}
/**
* 删除
* @return \think\response\Json
*/
public function del()
{
if (request()->isAjax()) {
$res = RegionModel::destroy(input('id'));
if ($res) {
return json(['code' => 0, 'msg' => '删除成功']);
}
}
return json(['code' => 1, 'msg' => '删除失败']);
}
public function select()
{
if(input('id')==0){
return [];
}
$list = RegionModel::where('pid', input('id'))->select();
if(!$list){
return [];
}
$list = collection($list)->visible(['id','title']);
return json($list);
}
public function test()
{
$level_1 = RegionModel::where('level', 1)->select();
$level_1 = collection($level_1)->visible(['id', 'title']);
return $this->fetch('', compact('level_1'));
}
}
\ No newline at end of file
<?php
namespace app\admin\controller;
use app\admin\controller\AuthBase;
use app\common\utils\HttpHelper;
use think\Controller;
use app\common\model\User as UserModel;
use think\Loader;
Loader::import('requests/library/Requests', EXTEND_PATH);
require_once EXTEND_PATH.'phpseclib/Crypt/RSA.php';
class Test extends AuthBase
{
public function _initialize()
{
parent::_initialize();
}
// 获取AccessToken:http://ysj.imgondar.com/admin/Test/access_token
public function access_token(){
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".config('wechat.appid')."&secret=".config('wechat.appsecret');
$params = [
"grant_type" => "client_credential",
"appid" => config('wechat.appid'),
"secret" => config('wechat.appsecret'),
];
$request = \Requests::get($url);
echo $request->body; exit;
}
}
\ No newline at end of file
<?php
namespace app\admin\controller;
use think\Controller;
class Ueditor extends Controller{
private $uploadfolder='/upload/'; //上传地址
private $scrawlfolder='/upload/_scrawl/'; //涂鸦保存地址
private $catchfolder='/upload/_catch/'; //远程抓取地址
private $configpath='./static/ueditor/php/config.json';
public function index(){
$this->type=input('edit_type','');
//header('Access-Control-Allow-Origin: http://www.baidu.com'); //设置http://www.baidu.com允许跨域访问
//header('Access-Control-Allow-Headers: X-Requested-With,X_Requested_With'); //设置允许的跨域header
date_default_timezone_set("Asia/shanghai");
error_reporting(E_ERROR);
header("Content-Type: text/html; charset=utf-8");
$CONFIG = json_decode(preg_replace("/\/\*[\s\S]+?\*\//", "", file_get_contents($this->configpath)), true);
$this->config=$CONFIG;
$action = input('action');
switch ($action) {
case 'config':
$result = json_encode($CONFIG);
break;
/* 上传图片 */
case 'uploadimage':
$result = $this->_upload();
break;
/* 上传涂鸦 */
case 'uploadscrawl':
$result = $this->_upload_scrawl();
break;
/* 上传视频 */
case 'uploadvideo':
$result = $this->_upload(array('maxSize' => 1073741824,/*1G*/'exts'=>array('mp4', 'avi', 'wmv','rm','rmvb','mkv')));
break;
/* 上传文件 */
case 'uploadfile':
$result = $this->_upload(array('exts'=>array('jpg', 'gif', 'png', 'jpeg','txt','pdf','doc','docx','xls','xlsx','zip','rar','ppt','pptx',)));
break;
/* 列出图片 */
case 'listimage':
/* 列出文件 */
case 'listfile':
$result = $this->_list($action);
break;
/* 抓取远程文件 */
case 'catchimage':
$result = $this->_upload_catch();
break;
default:
$result = json_encode(array('state'=> '请求地址出错'));
break;
}
/* 输出结果 */
if (isset($_GET["callback"]) && false ) {
if (preg_match("/^[\w_]+$/", $_GET["callback"])) {
echo htmlspecialchars($_GET["callback"]) . '(' . $result . ')';
} else {
echo json_encode(array(
'state'=> 'callback参数不合法'
));
}
} else {
exit($result) ;
}
}
//上传
private function _upload($config=array())
{
$title = '';
$url='';
if(!empty($config)){
$this->config=array_merge($this->config,$config);;
}
$file = request()->file('upfile');
if($file){
$validate=array(
'size'=>10240000 ,// 设置附件上传大小
'ext'=>array('jpg', 'gif', 'png', 'jpeg'),
);
$info = $file->validate($validate)->move(ROOT_PATH . 'public/' . $this->uploadfolder);
if($info) {
$img_url=$this->uploadfolder.$info->getSaveName();
// 图片压缩
// $image = \think\Image::open('./'.$img_url);
// $image->thumb(700,1400)->save('./'.$img_url);
$title =$info->getFilename();
$state = 'SUCCESS';
$url= $img_url;
}else{
$state = $file->getError();
}
}else{
$state = '未接收到文件';
}
$response=array(
"state" => $state,
"url" => $url,
"title" => $title,
"original" =>$title,
);
return json_encode($response);
}
private function _upload_scrawl()
{
$data = input('post.' . $this->config ['scrawlFieldName']);
$url='';
$title = '';
$oriName = '';
if (empty ($data)) {
$state= 'Scrawl Data Empty!';
} else {
$savepath = $this->save_image('png', base64_decode($data), $this->scrawlfolder);
if ($savepath) {
$state = 'SUCCESS';
$url = $savepath;
} else {
$state = 'Save scrawl file error!';
}
}
$response=array(
"state" => $state,
"url" => $url,
"title" => $title,
"original" =>$oriName ,
);
return json_encode($response);
}
//抓取远程文件
private function _upload_catch()
{
set_time_limit(0);
$sret = array(
'state' => '',
'list' => null
);
$savelist = array();
$flist = input('post.' . $this->config ['catcherFieldName'].'/a');
if (empty ($flist)) {
$sret ['state'] = 'ERROR';
} else {
$sret ['state'] = 'SUCCESS';
foreach ($flist as $f) {
if (preg_match('/^(http|ftp|https):\\/\\//i', $f)) {
$ext = strtolower(pathinfo($f, PATHINFO_EXTENSION));
if (in_array('.' . $ext, $this->config ['catcherAllowFiles'])) {
if ($img = file_get_contents($f)) {
$savepath = $this->save_image($ext, $img, $this->catchfolder);
if ($savepath) {
$savelist [] = array(
'state' => 'SUCCESS',
'url' => '/'.$savepath,
'size' => strlen($img),
'title' => '',
'original' => '',
'source' => htmlspecialchars($f)
);
} else {
$savelist [] = array(
'state' => 'Save remote file error!',
'url' => '',
'size' => '',
'title' => '',
'original' => '',
'source' => htmlspecialchars($f),
);
}
} else {
$savelist [] = array(
'state' => 'Get remote file error',
'url' => '',
'size' => '',
'title' => '',
'original' => '',
'source' => htmlspecialchars($f),
);
}
} else {
$sret ['state'] = 'File ext not allowed';
}
} else {
$savelist [] = array(
'state' => 'not remote image',
'url' => '',
'size' => '',
'title' => '',
'original' => '',
'source' => htmlspecialchars($f),
);
}
}
$sret ['list'] = $savelist;
}
return json_encode($sret);
}
private function save_image($ext = null, $content = null, $path = null)
{
$newfile = '';
$path=substr($path,0,2)=='./' ? substr($path,2) :$path;
$path=substr($path,0,1)=='/' ? substr($path,1) :$path;
if ($ext && $content) {
do {
$newfile = $path.str_replace("-","",date('Y-m-d/')) . uniqid() . '.' . $ext;
} while (file_exists($newfile));
$dir = dirname($newfile);
if (!is_dir($dir)) {
mkdir($dir, 0777, true);
}
file_put_contents($newfile, $content);
// 图片压缩
// $img_url='./'.$newfile;
// $image = \think\Image::open('./'.$img_url);
// $image->thumb(700,1400)->save('./'.$img_url);
}
return $newfile;
}
private function _list($action)
{
/* 判断类型 */
switch ($action) {
/* 列出文件 */
case 'listfile':
$allowFiles = $this->config['fileManagerAllowFiles'];
$listSize = $this->config['fileManagerListSize'];
$prefix='/';
break;
/* 列出图片 */
case 'listimage':
default:
$allowFiles = $this->config['imageManagerAllowFiles'];
$listSize = $this->config['imageManagerListSize'];
$prefix='/';
}
$allowFiles = substr(str_replace(".", "|", join("", $allowFiles)), 1);
/* 获取参数 */
$size = isset($_GET['size']) ? htmlspecialchars($_GET['size']) : $listSize;
$start = isset($_GET['start']) ? htmlspecialchars($_GET['start']) : 0;
$end = intval($start) + intval($size);
$path = $this->uploadfolder;
$files = $this->getfiles($path, $allowFiles);
if (!count($files)) {
return json_encode(array(
"state" => "no match file",
"list" => array(),
"start" => $start,
"total" => count($files)
));
}
/* 获取指定范围的列表 */
$len = count($files);
for ($i = min($end, $len) - 1, $list = array(); $i < $len && $i >= 0 && $i >= $start; $i--){
$list[] = $files[$i];
}
/* 返回数据 */
$result = json_encode(array(
"state" => "SUCCESS",
"list" => $list,
"start" => $start,
"total" => count($files)
));
return $result;
}
/**
* 遍历获取目录下的指定类型的文件
* @param string $path
* @param string $allowFiles
* @param array $files
* @return array
*/
private function getfiles($path, $allowFiles, &$files = array())
{
dump($path);
if (!is_dir($path)) return null;
if(substr($path, strlen($path) - 1) != '/') $path .= '/';
$handle = opendir($path);
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..') {
$path2 = $path . $file;
if (is_dir($path2)) {
$this->getfiles($path2, $allowFiles, $files);
} else {
if (preg_match("/\.(".$allowFiles.")$/i", $file)) {
$files[] = array(
'url'=> substr($path2,1),
'mtime'=> filemtime($path2)
);
}
}
}
}
return $files;
}
}
\ No newline at end of file
<?php
namespace app\admin\controller;
use think\Controller;
use Qiniu\Storage\UploadManager;
use Qiniu\Auth;
use app\common\model\Picture as PictureModel;
class Upload extends Controller
{
public $accessKey;
public $secretKey;
public $domain;
public $auth;
public $bucket;
public $token;
public $UploadMgr;
public function _initialize()
{
parent::_initialize();
$this->accessKey = config('qiniu.accessKey');
$this->secretKey = config('qiniu.secretKey');
$this->domain = config('qiniu.domain');
$this->bucket = config('qiniu.bucket');
$this->auth = new Auth($this->accessKey, $this->secretKey);
$this->token = $this->auth->uploadToken($this->bucket);
$this->uploadMgr = new UploadManager();
}
public function single()
{
$file = request()->file('file');
// 要上传文件的本地路径
$filePath = $file->getRealPath();
//后缀
$ext = pathinfo($file->getInfo('name'), PATHINFO_EXTENSION);
// 上传到七牛后保存的文件名
$key = substr(md5($file->getRealPath()), 0, 5).date('YmdHis').rand(0, 9999).'.'.$ext;
// 调用 UploadManager 的 putFile 方法进行文件的上传
list($ret, $err) = $this->uploadMgr->putFile($this->token, $key, $filePath);
if ($err !== null) {
return json_encode(['error'=>1, 'msg'=>'上传失败', 'result'=>$err]);
} else {
$result['url'] = $this->domain.'/'.$ret['key'];
return json_encode(['error'=>0, 'msg'=>'上传成功', 'result'=>$result]);
}
}
/**
* 保存文件到七牛云
* @param string $file [description]
* @return [type] [description]
*/
public function sava($file='')
{
$result['error'] = 1;
$result['msg'] = '上传文件到远程失败';
$result['result'] = null;
// 要上传文件的本地路径
$filePath = $file->getRealPath();
//后缀
$ext = pathinfo($file->getInfo('name'), PATHINFO_EXTENSION);
// 上传到七牛后保存的文件名
$key = substr(md5($file->getRealPath()), 0, 5).date('YmdHis').rand(0, 9999).'.'.$ext;
// 调用 UploadManager 的 putFile 方法进行文件的上传
list($ret, $err) = $this->uploadMgr->putFile($this->token, $key, $filePath);
if ($err !== null) {
$result['result'] = $err;
return $result;
} else {
$resource_model = model('resource');
$resource_model->isUpdate(false)->data([
'name' => $ret['key'],
'ext' => $ext,
'address' => $this->domain.'/'.$ret['key'],
'use_num' => 1
])->save();
$result['error'] = 0;
$result['msg'] = '成功上传文件到远程';
$result['result']['url'] = $this->domain.'/'.$ret['key'];
return $result;
}
}
public function savaAsync()
{
$name = input('post.name');
$file = input('file.')[$name];
$result['result'] = null;
// 要上传文件的本地路径
$filePath = $file->getRealPath();
$fileName = $file->getInfo('name');
//后缀
$ext = pathinfo($file->getInfo('name'), PATHINFO_EXTENSION);
// 上传到七牛后保存的文件名
$key = substr(md5($file->getRealPath()), 0, 5).date('YmdHis').rand(0, 9999).'.'.$ext;
// 调用 UploadManager 的 putFile 方法进行文件的上传
list($ret, $err) = $this->uploadMgr->putFile($this->token, $key, $filePath);
if ($err !== null) {
$result['error'] = $fileName.'上传到远程失败';
$result['result'] = $err;
return $result;
} else {
$resource_model = model('Resource');
$server_id = $resource_model -> insertGetId(array(
'name' => $ret['key'],
'ext' => $ext,
'address' => $this->domain.'/'.$ret['key'],
'use_num' => 1
));
$result['success'] = $fileName.'上传成功';
$result['result']['server_id'] = $server_id;
$result['result']['url'] = $this->domain.'/'.$ret['key'];
return $result;
}
}
public function deleteAsync()
{
$id = input('post.id');
$res = model('Resource')->where("id", $id)-> delete();
if ($res) {
return array('code'=>0);
}
return array('code'=>0);
}
/**
* 删除图片
* @return [type] [description]
*/
public function delete()
{
$picture = PictureModel::get(trim(input('post.key')));
if ($picture) {
if ($picture->delete()) {
$pictures = PictureModel::where(['type'=>trim(input('param.type')), 'oid'=>trim(input('param.id'))])->select();
$pics = array();
foreach ($pictures as $k => $pic) {
$pics[$k]['id'] = intval($pic->id);
$pics[$k]['url'] = $pic->url;
}
return json_encode(['error'=>0, 'msg'=>'删除成功', 'pics'=>$pics]);
}else{
return json_encode(['error'=>1, 'msg'=>'删除失败']);
}
}else{
return json_encode(['error'=>1, 'msg'=>'该图片不存在']);
}
}
/**
* 七牛云上传凭证
* @return [type] [description]
*/
public function uptoken()
{
$result['error'] = 0;
$result['msg'] = '获取成功';
// $policy = array(
// 'callbackUrl' => 'http://your.domain.com/callback.php',
// 'callbackBody' => 'filename=$(fname)&filesize=$(fsize)'
// );
// $uptoken = $auth->uploadToken($bucket, null, 3600, $policy);
$auth = new Auth($this->accessKey, $this->secretKey);
$upToken = $auth->uploadToken($this->bucket);
$result['uptoken'] = $upToken;
return json_encode($result);
}
}
<?php
/**
* Created by PhpStorm.
* User: wanggang
* Date: 2018/9/27
* Time: 上午3:21
*/
namespace app\admin\controller;
use app\admin\controller\AuthBase;
use app\admin\controller\OutputExcel;
class User extends AuthBase
{
public function _initialize()
{
parent::_initialize();
}
public function index(){
$nickname = input('get.nickname');
$is_vip = input('get.is_vip');
$start_time = input('get.start_time');
$end_time = input('get.end_time');
$phone = input('get.phone');
$condition = [];
if($nickname){
$condition['nickname'] = ['like','%'.$nickname.'%'];
}
if($is_vip){
$condition['is_vip'] = $is_vip;
}
if($phone){
$condition['phone'] = $phone;
}
if($start_time&&$end_time){
$condition['created_at'] = ['between',[$start_time.' 00:00:00',$end_time.' 00:00:00']];
}else{
if($start_time){
$condition['created_at'] = ['>',$start_time.' 00:00:00'];
}elseif($end_time){
$condition['created_at'] = ['<',$end_time.' 00:00:00'];
}
}
$user_model = model('user');
$user_list = $user_model->where($condition)->order('created_at desc')
->paginate(10,['query'=>['nickname'=>$nickname,'is_vip'=>$is_vip,'start_time'=>$start_time,'end_time'=>$end_time,'phone'=>$phone]]);
$this->assign('user_list',$user_list);
return $this->fetch();
}
public function userOutPut(){
$nickname = input('get.nickname');
$is_vip = input('get.is_vip');
$start_time = input('get.start_time');
$end_time = input('get.end_time');
$condition = [];
if($nickname){
$condition['nickname'] = ['like','%'.$nickname.'%'];
}
if($is_vip){
$condition['is_vip'] = $is_vip;
}
if($start_time&&$end_time){
$condition['created_at'] = ['between',[$start_time.' 00:00:00',$end_time.' 00:00:00']];
}else{
if($start_time){
$condition['created_at'] = ['>',$start_time.' 00:00:00'];
}elseif($end_time){
$condition['created_at'] = ['<',$end_time.' 00:00:00'];
}
}
$user_list = model('user')->where($condition)->field('nickname,gender,phone,is_vip,created_at,updated_at,vip_endtime')->select();
$mulit_arr = [];
$mulit_arr['data'] = [];
$cont = [['昵称','性别','电话','是否是会员','注册时间','更新时间','会员到期时间']];
// [
// 'data'=>
// [
// [
// ['昵称','性别','电话','是否是会员','注册时间','更新时间','会员到期时间'],
// ['a','b','c'],
// ['d','e','f']
// ]
// ],
// 'sheet'=>
// [
// ['title'=>'工作空间1名称'],
// ['title'=>'工作空间2名称'],
// ]
// ];
foreach ($user_list as $vo){
$arr = [];
$arr[] = $vo['nickname'];
$arr[] = $vo['gender']==1?'男':'女';
$arr[] = $vo['phone'];
$arr[] = $vo['is_vip']==0?'否':'是';
$arr[] = $vo['created_at'];
$arr[] = $vo['updated_at'];
$arr[] = $vo['vip_endtime'];
$cont[] = $arr;
}
$mulit_arr['data'][] =$cont;
$mulit_arr['sheet'] = [['title'=>'用户信息表']];
// dump($mulit_arr);
// return;
/*调用*/
$title = '用户表';//这是标题
$Subject='';//这是备注
$Description='美行者用户导出';//这是描述;
$Keywords='';//这是关键字
$Category='';//这是分类
$filename = '美行者用户导出';//文件名
$obj = new OutputExcel();
$obj->export($mulit_arr,$filename,$title,$Subject,$Description,$Keywords,$Category);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: 30868
* Date: 2018/9/15
* Time: 1:05
*/
namespace app\admin\validate;
use think\Validate;
class Post extends Validate
{
protected $rule = [
['title','require','文章标题不能为空'],
['sort','number','序号必须为数字'],
['id','require','缺少必要参数ID'],
['status','number|in:-1,0,1','状态必须是数字|状态范围不合法'],
['content','require','文章内容不能为空'],
['poster','require','文章封面必须上传']
];
// 场景设置
protected $scene = [
'create' => ['title','content','poster'],
'update' => ['title','content']
];
}
<?php
namespace app\admin\validate;
use think\Validate;
class Project extends Validate
{
protected $rule = [
['name','require|max:30','名称必须传递|名称不能超过30个字符'],
['sort','number','序号必须为数字'],
['id','require|number','缺少必要参数ID'],
['status','number|in:-1,0,1','状态必须是数字|状态范围不合法'],
['poster','require','图片必须上传'],
];
// 场景设置
protected $scene = [
'addTag' => ['name','sort'],
'updateTag' => ['name','sort','id'],
'addCatalogs' => ['name','sort','poster']
];
}
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 管理员管理</h3>
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline" method="GET">
<div class="form-group">
<label class="sr-only" for="keyword">关键词</label>
<input type="text" class="form-control" name="word" id="keyword" placeholder="关键词" value="<?php echo input('get.word');?>">
</div>
<button type="submit" class="btn btn-primary">搜索</button>
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>ID</th>
<th>用户名</th>
<th>是否登录</th>
<th>时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach($admins as $u => $user):?>
<tr id="tr_<?php echo $user->id;?>">
<td><?php echo $user->id;?></td>
<td>
<a href="javascript:void(0);" class="btn-detail" oid="<?php echo $user->id;?>">
<?php echo $user->username;?>
</a>
</td>
<td><?php echo $user->is_login;?></td>
<td><?php echo $user->created_at;?></td>
<td>
<button oid="<?php echo $user->id;?>" type="button" class="btn btn-primary btn-xs btn-update-admin" data-toggle="tooltip" data-placement="top" data-original-title="编辑">
<i class="fa fa-pencil"></i>
</button>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$admins->render()}
</div>
</div>
</section>
{literal}
<script id="user" type="text/html">
<div class="row margin-0">
<div class="col-md-12">
<h3 class="text-center">{{user.name}}</h3>
</div>
</div>
<hr/>
<div class="row margin-horizontal-0">
<div class="col-md-3 padding-right-0 text-right">
<span>昵称: </span>
</div>
<div class="col-md-9 padding-left-xs">
<p class="text-left">
<span class="text-primary">{{user.name}}</span>
</p>
</div>
</div>
<div class="row margin-horizontal-0">
<div class="col-md-3 padding-right-0 text-right">
<span>登录状态: </span>
</div>
<div class="col-md-9 padding-left-xs">
<p class="text-left">
<span class="text-primary">{{user.is_login}}</span>
</p>
</div>
</div>
<div class="row margin-horizontal-0">
<div class="col-md-3 padding-right-0 text-right">
<span>创建时间: </span>
</div>
<div class="col-md-9 padding-left-xs">
<p class="text-left">
<span class="text-primary">{{user.created_at}}</span>
</p>
</div>
</div>
</script>
{/literal}
<div class="modal fade" id="update-modal" tabindex="-1" role="dialog" aria-labelledby="updateModal" data-backdrop="static">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="copyModal">编辑资料</h4>
</div>
<div class="modal-body">
<div class="form-group margin-right">
<label for="robot">帐号</label>
<input class="form-control" name="name" id="admin-name">
</input>
</div>
<div class="form-group margin-right" id="groups-sel2">
<label for="group">密码</label>
<input class="form-control" name="password" id="admin-password">
</input>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary btn-save">保存</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(function () {
$('[data-toggle="tooltip"]').tooltip();
// 右侧详情
$('.btn-detail').unbind('click').bind('click', function (event) {
event.stopPropagation();
event.preventDefault();
document.getElementById('right-detail-content').innerHTML = "";
var url = "/admin/Admin/read";
var oid = $(this).attr('oid');
showRightDetail(function () {
$.get(url + "/id/" + oid, function (res) {
var res = JSON.parse(res);
console.log(res);
if (res.error) {
new PNotify({
title: '提示',
text: res.msg,
'type': 'error'
});
} else {
var html = template('user', res.data);
document.getElementById('right-detail-content').innerHTML = html;
}
});
});
});
$(".btn-update-admin").click(function(){
event.preventDefault();
var _this = $(this);
var oid = $(this).attr("oid");
var _modal = $('#update-modal').modal('show');
var name = $("#tr_"+oid).find("td:eq(1)").text().trim();
_modal.find("#admin-name").val(name);
_modal.find('.btn-save').unbind('click').bind('click', function () {
var _that = $(this);
var name = $.trim(_modal.find('#admin-name').val());
var password = _modal.find('#admin-password').val();
if (name == '') {
new PNotify({
title: '提示',
text: '请填写必要信息'
});
return;
};
var $btn = _that.button('loading');
var url = "/admin/Admin/update?id="+oid;
$.ajax({
url: url,
type: 'POST',
dataType: 'json',
data: {
name: name,
password: password
},
cache: false,
})
.done(function (res) {
var res = JSON.parse(res);
if (res.error) {
new PNotify({
title: '提示',
text: res.msg
});
} else {
window.location.reload();
}
})
.fail(function (res) {
new PNotify({
title: '提示',
text: '网络请求失败'
});
})
.always(function () {
_modal.modal('hide');
$btn.button('reset');
});
});
});
});
</script>
\ No newline at end of file
{layout name="public/layout_login"}
<style type="text/css">
#captcha_div input{
float: left;
width: 52%;
height: 50px;
}
#captcha_div img{
float: left;
margin-left: 10px;
width: 125px;
height: 50px;
border-radius: 4px;
margin-bottom: 20px;
}
</style>
<div id="login-page">
<div class="container">
<form class="form-login" action="/admin/Login/login" method="POST">
<h2 class="form-login-heading">登录</h2>
<div class="login-wrap">
<input type="text" class="form-control" name="username" placeholder="User ID" autofocus>
<br>
<input type="password" class="form-control" name="password" placeholder="Password">
<br/>
<div id="captcha_div">
<input type="captcha" class="form-control" name="captcha" placeholder="验证码">
<div>
<img id="verify_img" src="{:captcha_src()}" alt="验证码" onclick="refreshVerify()">
</div>
</div>
<br/>
<button class="btn btn-theme btn-block" type="submit">
登录
</button>
<hr>
<div class="login-social-link centered">
<p>没有账号?请联系管理员</p>
</div>
</form>
</div>
</div>
<script type="text/javascript">
// 刷新验证码 - http://www.thinkphp.cn/topic/49805.html
function refreshVerify() {
var ts = Date.parse(new Date())/1000;
var img = document.getElementById('verify_img');
img.src = "/captcha?id="+ts;
}
</script>
{layout name="public/layout_main"}
<link rel="stylesheet" href="/static/fileinput/css/fileinput.css">
<link rel="stylesheet" href="/static/bootstrap-select/css/bootstrap-select.min.css">
<style type="text/css">
.progress-bar{
text-align: center;
}
.dropdown-menu{
z-index: 100000;
}
</style>
<section class="wrapper">
<h3 class="">
<a href="<?php echo url('@admin/Post/index')?>">
<i class="fa fa-angle-right"></i> <a href="{:url('admin/post/index')}">文章管理</a> <i class="fa fa-angle-right"></i> 发布文章
</a>
</h3>
<hr>
<?php if(isset($msg) && $msg):?>
<div class="row margin-bottom">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<?php echo $msg;?>
</div>
</div>
</div>
<?php endif;?>
<div class="row margin-bottom">
<div class="col-md-12">
<form name="myFrom" class="form-horizontal" enctype="multipart/form-data" method="POST" action="{:url('admin/banner/create')}")?>" id="article-create-form">
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right" >图片</label>
<div class="col-lg-10">
<input id="input-b1" name="image" type="file">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">文章类型</label>
<div class="col-lg-10">
<select class="form-control" name="type" id="post_type">
<option value="1">小程序页面路径</option>
<option value="2">跳转到网页链接地址</option>
</select>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">请输入链接</label>
<div class="col-lg-10">
<input type="text" name="href" class="form-control">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">是否显示</label>
<div class="col-lg-10">
<select class="form-control" name="type" id="post_type">
<option value="1">显示</option>
<option value="2">隐藏</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-10">
<button type="submit" class="btn btn-default" id="btn-save">提交</button>
</div>
</div>
</form>
</div>
</div>
</section>
<!-- 文件上传和select插件 -->
<script type="text/javascript" src="/static/fileinput/js/fileinput.min.js"></script>
<script type="text/javascript" src="/static/fileinput/js/locales/zh.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/bootstrap-select.min.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/i18n/defaults-zh_CN.js"></script>
<!-- 配置文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
// 初始化文件上传
initFileInput($("#input-b1"));
// 单文件上传
function initFileInput(el,initArr,initConfig){
// var initialPreview = [];
// initialPreview.push(initArr);
el.fileinput({
language: 'zh',
uploadExtraData:{'name':name},
// initialPreview: initialPreview,
uploadExtraData:{'name':'banner-choose'},
// initialPreviewConfig: initConfig,
autoReplace : true,
showUpload:false, //是否显示上 传按钮
initialPreviewShowDelete:true,
initialPreviewAsData: true,
dropZoneEnabled: false,
showRemove :false,
showUpload:false, //是否显示上 传按钮
overwriteInitial:true,
showUploadedThumbs:false,
allowedFileExtensions: ['bmp','jpg','png','tif','gif','pcx','tga','exif','fpx','svg','cdr','pcd','dxf','ufo','eps','raw','WMF','webp'],//接收的文件后缀
})
}
</script>
{layout name="public/layout_main"}
<link rel="stylesheet" href="/static/validation/css/validationEngine.jquery.css">
<link rel="stylesheet" href="/static/fileinput/css/fileinput.css">
<link rel="stylesheet" href="/static/bootstrap-select/css/bootstrap-select.min.css">
<style type="text/css">
.progress-bar{
text-align: center;
}
.dropdown-menu{
z-index: 100000;
}
</style>
<section class="wrapper">
<h3 class="">
<a href="<?php echo url('@admin/Post/index')?>">
<i class="fa fa-angle-right"></i> <a href="{:url('admin/banner/index')}">轮播图管理</a> <i class="fa fa-angle-right"></i> 添加轮播图
</a>
</h3>
<hr>
<?php if(isset($msg) && $msg):?>
<div class="row margin-bottom">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<?php echo $msg;?>
</div>
</div>
</div>
<?php endif;?>
<div class="row margin-bottom">
<div class="col-md-12">
<form name="myFrom" id="myFrom" class="form-horizontal" enctype="multipart/form-data" method="POST" action="{:url('admin/banner/create')}" id="article-create-form">
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right" >图片</label>
<div class="col-lg-10 col-md-8 col-lg-6">
<input id="input-b1" name="image" class="validate[required]" type="file">
<span class="form-group-tip"> * 尺寸建议:375px*360px </span>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">类型</label>
<div class="col-lg-10 col-md-8 col-lg-6">
<select class="form-control" name="type" id="post_type">
<option value="1">小程序页面路径</option>
<option value="2">跳转到网页链接地址</option>
</select>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">链接</label>
<div class="col-lg-10 col-md-8 col-lg-6">
<input type="text" name="url" class="form-control validate[required]" >
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">状态</label>
<div class="col-lg-10 col-md-8 col-lg-6">
<select class="form-control" name="status" id="post_type">
<option value="1">显示</option>
<option value="2">不显示</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-10">
<button type="submit" class="btn btn-success" id="btn-save">提交</button>
</div>
</div>
</form>
</div>
</div>
</section>
<!-- 文件上传和select插件 -->
<script type="text/javascript" src="/static/fileinput/js/fileinput.min.js"></script>
<script type="text/javascript" src="/static/fileinput/js/locales/zh.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/bootstrap-select.min.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/i18n/defaults-zh_CN.js"></script>
<script type="text/javascript" src="/static/validation/js/jquery.validationEngine-zh_CN.js"></script>
<script type="text/javascript" src="/static/validation/js/jquery.validationEngine.js"></script>
<!-- 配置文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
$("#myFrom").validationEngine();
// 初始化文件上传
initFileInput($("#input-b1"));
// 单文件上传
function initFileInput(el,initArr,initConfig){
// var initialPreview = [];
// initialPreview.push(initArr);
el.fileinput({
language: 'zh',
uploadExtraData:{'name':name},
// initialPreview: initialPreview,
uploadExtraData:{'name':'banner-choose'},
// initialPreviewConfig: initConfig,
autoReplace : true,
showUpload:false, //是否显示上 传按钮
initialPreviewShowDelete:true,
initialPreviewAsData: true,
dropZoneEnabled: false,
showRemove :false,
showUpload:false, //是否显示上 传按钮
overwriteInitial:true,
showUploadedThumbs:false,
allowedFileExtensions: ['bmp','jpg','png','tif','gif','pcx','tga','exif','fpx','svg','cdr','pcd','dxf','ufo','eps','raw','WMF','webp'],//接收的文件后缀
})
}
</script>
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 轮播图管理</h3>
<!-- 分割线 -->
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline pull-left" method="GET" id="order-search" action="<?php echo url('@admin/banner/index')?>">
<div class="form-group">
<select name="status" class="form-control" id="status">
<option value="">显示状态</option>
<option value="1" {if condition="input('status')=='1'"}selected{/if}>显示</option>
<option value="2" {if condition="input('status')=='2'"}selected{/if}>不显示</option>
</select>
</div>
<!--<button type="submit" class="btn btn-primary">搜索</button>-->
</form>
<div class="pull-left margin-left">
<a href="{:url('admin/banner/create')}" class="btn btn-success">添加轮播图</a>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-bordered table-striped">
<!--<colgroup>-->
<!--<col style="width: 2%;">-->
<!--<col style="width: 80%;">-->
<!--<col style="width: 5%;">-->
<!--<col style="width: 5%;">-->
<!--<col style="width: 10%;">-->
<!--</colgroup>-->
<thead>
<tr>
<th>ID</th>
<th>图片</th>
<th>类型</th>
<th>地址</th>
<th>是否显示</th>
<th>发布时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{volist name="banner_list" id="vo" key="k" empty="暂时没有数据"}
<tr id="tr_{$vo.id}">
<td>{$vo.id}</td>
<td>
<a href="<?=$vo->image?>" target="_blank" data-fancybox="images">
<img src="<?=$vo->image?>" width='100'>
</a>
</td>
<td>
{if condition="$vo.type==1"}
小程序页面路径
{else/}
网页链接地址
{/if}
</td>
<td>{$vo.url}</td>
<td>
{if condition="$vo.status == 1"}
显示
{else/}
不显示
{/if}
</td>
<td>{$vo.created_at}</td>
<td>
<a href="{:url('admin/banner/update',['id'=>$vo.id])}" class="btn btn-xs btn-primary"><i class="fa fa-pencil"></i></a>
<a href="javascript:" oid="{$vo.id}" class="btn btn-xs btn-danger btn-delete"><i class="fa fa-trash"></i></a>
</td>
</tr>
{/volist}
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$banner_list->render()}
</div>
</div>
</section>
<script type="text/javascript">
// 文档加载完毕之后,会进入该方法
$("#status").change(function(){
$("#order-search").submit();
});
$(function(){
$(".btn-delete").click(function(){
var _this = $(this);
var url = "{:url('admin/banner/delete')}";
var oid = _this.attr('oid');
showDialog("提示", "确定删除该轮播图吗?", function(){
// ajax post 方法
$.post(url, {id:oid}, function (res) {
// var res = JSON.parse(res);
if (res.code == 1) {
// javascript 的默认弹出提示方法
_this.remove();
$("#tr_"+oid).fadeOut();
} else {
alert(res.msg);
}
});
});
});
});
</script>
{layout name="public/layout_main"}
<link rel="stylesheet" href="/static/validation/css/validationEngine.jquery.css">
<link rel="stylesheet" href="/static/fileinput/css/fileinput.css">
<link rel="stylesheet" href="/static/bootstrap-select/css/bootstrap-select.min.css">
<style type="text/css">
.progress-bar{
text-align: center;
}
.dropdown-menu{
z-index: 100000;
}
</style>
<section class="wrapper">
<h3 class="">
<a href="<?php echo url('@admin/Post/index')?>">
<i class="fa fa-angle-right"></i> <a href="{:url('admin/banner/index')}">轮播图管理</a> <i class="fa fa-angle-right"></i>
{if condition="$banner_info"}
修改轮播图
{else/}
添加轮播图
{/if}
</a>
</h3>
<hr>
<?php if(isset($msg) && $msg):?>
<div class="row margin-bottom">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<?php echo $msg;?>
</div>
</div>
</div>
<?php endif;?>
<div class="row margin-bottom">
<div class="col-md-12">
<form name="myFrom" id="myFrom" class="form-horizontal" enctype="multipart/form-data" method="POST" {if condition="$banner_info"}action="{:url('admin/banner/update',['id'=>$banner_info.id])}"{else/}action="{:url('admin/banner/create')}"{/if} id="article-create-form">
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right" >图片</label>
<div class="col-lg-10 col-md-8 col-lg-6">
<input id="input-b1" name="image" type="file">
<span class="form-group-tip"> * 尺寸建议:375px*360px </span>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">类型</label>
<div class="col-lg-10 col-md-8 col-lg-6">
<select class="form-control" name="type" id="post_type">
<option value="1" {if condition="$banner_info.type == 1"}selected{/if}>小程序页面</option>
<option value="2" {if condition="$banner_info.type == 2"}selected{/if}>网页链接</option>
</select>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">目标路径</label>
<div class="col-lg-10 col-md-8 col-lg-6">
<input type="text" name="url" class="form-control validate[required]" value="{$banner_info.url}">
<span class="form-group-tip"> * 网页直接输入链接地址即可;<br/>* 小程序页面,详情页路径为:/pages/detail/index?id=[项目ID]<br/>
* 把其中的[项目ID]替换成活动管理模块的的ID值即可 <br/>
* 小程序其他页面路径请咨询小程序开发者 </span>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">状态</label>
<div class="col-lg-10 col-md-8 col-lg-6">
<select class="form-control" name="status" id="post_type">
<option value="1" {if condition="$banner_info.status == 1"}selected{/if}>显示</option>
<option value="2" {if condition="$banner_info.status == 2"}selected{/if}>不显示</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-10">
<button type="submit" class="btn btn-success" id="btn-save">提交</button>
</div>
</div>
</form>
</div>
</div>
</section>
<!-- 文件上传和select插件 -->
<script type="text/javascript" src="/static/fileinput/js/fileinput.min.js"></script>
<script type="text/javascript" src="/static/fileinput/js/locales/zh.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/bootstrap-select.min.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/i18n/defaults-zh_CN.js"></script>
<script type="text/javascript" src="/static/validation/js/jquery.validationEngine-zh_CN.js"></script>
<script type="text/javascript" src="/static/validation/js/jquery.validationEngine.js"></script>
<!-- 配置文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
$("#myFrom").validationEngine();
// 初始化文件上传
initFileInput($("#input-b1"),"{$banner_info.image}");
// 单文件上传
function initFileInput(el,initArr,initConfig){
var initialPreview = [];
if(initArr){
initialPreview.push(initArr);
}
el.fileinput({
language: 'zh',
initialPreview: initialPreview,
uploadExtraData:{'name':'banner-choose'},
autoReplace : true,
initialPreviewShowDelete:true,
initialPreviewAsData: true,
dropZoneEnabled: false,
showRemove :false,
showUpload:false, //是否显示上 传按钮
overwriteInitial:true,
showUploadedThumbs:false,
allowedFileExtensions: ['bmp','jpg','png','tif','gif','pcx','tga','exif','fpx','svg','cdr','pcd','dxf','ufo','eps','raw','WMF','webp'],//接收的文件后缀
})
}
</script>
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i>商家入住管理</h3>
<!-- 分割线 -->
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline pull-left" method="GET" action="/admin/Business/index">
<div class="form-group margin-right">
<input class="form-control" type="text" name="business_name" value="{:input('business_name')}"
placeholder="商家名称">
</div>
<button type="submit" class="btn btn-primary">搜索</button>
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th width="50">ID</th>
<th width="200">商家名称</th>
<th width="150">商家类型</th>
<th width="150">联系人</th>
<th width="150">手机号</th>
<th width="150">微信号</th>
<th style="min-width:250px;">备注</th>
<th width="150">申请时间</th>
</tr>
</thead>
<tbody>
{foreach $business as $v}
<tr>
<td>{$v['id']}</td>
<td>{$v['business_name']}</td>
<td>{:config('business_type')[$v['business_type']]}</td>
<td>{$v['contacts']}</td>
<td>{$v['phone']}</td>
<td>{$v['wx_number']}</td>
<td>{$v['remark']}</td>
<td>{$v['created_at']}</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$business->render()}
</div>
</div>
</section>
<script type="text/javascript">
</script>
{layout name="public/fullscreen"}
<link rel="stylesheet" href="/static/fileinput/css/fileinput.css">
<link rel="stylesheet" href="/static/bootstrap-select/css/bootstrap-select.min.css">
<style type="text/css">
.progress-bar{
text-align: center;
}
.dropdown-menu{
z-index: 100000;
}
</style>
<section class="wrapper">
<h3 class="">
<a href="<?php echo url('@admin/Guide/index')?>">
<i class="fa fa-angle-right"></i> <a href="{:url('admin/Guide/index')}">美行攻略</a> <i class="fa fa-angle-right"></i> 发布攻略
</a>
</h3>
<hr>
<?php if(isset($msg) && $msg):?>
<div class="row margin-bottom">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<?php echo $msg;?>
</div>
</div>
</div>
<?php endif;?>
<div class="row margin-bottom">
<div class="col-md-12">
<form name="myFrom" class="form-horizontal" enctype="multipart/form-data" method="POST" action="<?php echo url("@admin/Guide/create")?>" id="article-create-form">
<div class="form-group">
<label for="title" class="col-sm-2 control-label text-right">攻略标题</label>
<div class="col-sm-10 col-md-8 col-lg-6">
<input type="text" class="form-control validate[required]" name="title" id="title" placeholder="请输入美行攻略的标题">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-2 control-label text-right">攻略简介</label>
<div class="col-sm-10 col-md-8 col-lg-6">
<textarea name="intro" id="" cols="30" rows="3" class="form-control" placeholder="请输入美行攻略的简单描述"></textarea>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-2 control-label text-right" >攻略封面</label>
<div class="col-sm-10 col-md-8 col-lg-6">
<input id="input-b1" name="poster" type="file">
<span class="form-group-tip"> * 尺寸建议:260px*190px </span>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-2 control-label text-right">攻略标签</label>
<div class="col-sm-10 col-md-8 col-lg-6">
<input type="hidden" name="tags" id="tags" value="">
<select class="selectpicker form-control" id="tags_select" multiple data-live-search="true" onchange="setTags()">
{volist name="tag_list" name="tag_list" id="vo"}
<option value="{$vo.id}">{$vo.name}</option>
{/volist}
</select>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-2 control-label text-right">攻略类型</label>
<div class="col-sm-10 col-md-8 col-lg-6">
<select class="form-control" name="type" id="post_type">
<option value="1">手动编写文章</option>
<option value="2">链接到网络文章</option>
</select>
</div>
</div>
<div class="form-group" id="href" style="display: none">
<label for="title" class="col-sm-2 control-label text-right">请输入url</label>
<div class="col-sm-10 col-md-8 col-lg-6">
<input type="text" name="href" class="form-control">
<code>http:// + 网址 或 https:// + 网址</code>
</div>
</div>
<div class="form-group" id="content">
<label for="content" class="col-sm-2 control-label text-right">攻略详情</label>
<div class="col-sm-10 col-md-8 col-lg-6">
<!-- 加载编辑器的容器 -->
<script id="post_container" name="content" type="text/plain" style="width: 100%">
</script>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-success" id="btn-save">提交</button>
</div>
</div>
</form>
</div>
</div>
</section>
<!-- 文件上传和select插件 -->
<script type="text/javascript" src="/static/fileinput/js/fileinput.min.js"></script>
<script type="text/javascript" src="/static/fileinput/js/locales/zh.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/bootstrap-select.min.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/i18n/defaults-zh_CN.js"></script>
<!-- 配置文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
$(function(){
// 即时显示封面图
$('#poster').change(function(e){
var file = e.target.files[0];
preview(file, 0);
});
var type = $("#post_type").val();
if(type == 1){
$("#content").show();
$("#href").hide();
}else{
$("#href").show();
$("#content").hide();
}
});
$("#post_type").change(function(){
var type = $(this).val();
if(type == 1){
$("#content").show();
$("#href").hide();
}else{
$("#href").show();
$("#content").hide();
}
});
// 初始化文件上传
$("#input-b1").fileinput({
language: 'zh',
showUpload:false, //是否显示上传按钮
allowedFileExtensions: ['bmp','jpg','png','tif','gif','pcx','tga','exif','fpx','svg','cdr','pcd','dxf','ufo','eps','raw','WMF','webp'],//接收的文件后缀
})
function setTags(){
var slected = $("#tags_select").val();
if(slected){
$("#tags").val(slected.toString());
}else{
$("#tags").val("");
}
}
UE.getEditor('post_container', {
//编辑区域大小
'initialFrameHeight' : '350',
'elementPathEnabled':false,
'autoHeight': true,
'autoHeightEnabled':true,
'autoFloatEnabled': true,
'iframeCssUrl': '/static/ueditor/themes/iframe.css',// 引入css
//定制菜单
'toolbars' : [
[
'fullscreen', 'source', 'undo', 'redo', '|',
'fontsize',
'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat',
'formatmatch', 'blockquote', 'pasteplain', '|',
'forecolor', 'backcolor', '|',
'lineheight', '|',
'indent', '|', 'insertimage', '|',
'justifyleft', //居左对齐
'justifyright', //居右对齐
'justifycenter', //居中对齐
'justifyjustify', //两端对齐
],
]
});
</script>
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 美行攻略</h3>
<!-- 分割线 -->
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline pull-left" method="GET" action="<?php echo url('@admin/Guide/index')?>">
<div class="form-group margin-right">
<select name="" id="" class="form-control" onchange="location.href='{:url('index')}'+'?order='+this.value">
<option value="1" {:input('sort',0)==1?'selected':'';}>最新(排序)</option>
<option value="2" {:input('sort',0)==2?'selected':'';}>最热(排序)</option>
</select>
</div>
<div class="form-group margin-right">
<input class="form-control" type="text" name="title" id="title" value="<?php echo input('title');?>"
placeholder="攻略标题"/>
</div>
<button type="submit" class="btn btn-primary">搜索</button>
</form>
<div class="pull-left margin-left">
<a href='<?php echo url("@admin/Guide/create")?>' type="button" class="btn btn-success"
style="margin-left:30px;">
发布攻略
</a>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>ID</th>
<th>攻略标题</th>
<th>类型</th>
<th>简介</th>
<th>标签</th>
<th>封面</th>
<th>排序</th>
<th>发布时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($articles as $k => $article):?>
<tr id="tr_<?php echo $article->id;?>">
<td><?php echo $article->id;?></td>
<td style="max-width:450px;">
{if condition="$article.type == 1"}
<a href="<?php echo url('@mob/Guide/read', 'id='.$article->id);?>/" target='_blank'>
<?php echo $article->title;?>
</a>
{else/}
<a href="{$article->content}" target='_blank'>
<?php echo $article->title;?>
</a>
{/if}
</td>
<td> <?=$article->type=='1'?'自建文章':'网络文章';?></td>
<td style="max-width:200px;"> <?=$article->intro;?></td>
<td style="max-width: 200px">
{volist name="$article.tags" id="tag" key="k"}{if condition="$k!=1"}/{/if}{$tag}{/volist}
</td>
<td>
<a href="<?=$article->poster?>" target="_blank" data-fancybox="images">
<img src="<?=$article->poster?>" width='100'>
</a>
</td>
<td align="center"><input onchange="changeSort({$article['id']},this.value);" style="width: 80px" type="text" name="sort"
value="{$article.sort}"></td>
<td><?php echo $article->created_at;?></td>
<td style="min-width:100px;">
<a href="<?php echo url('@admin/Guide/update', 'id='.$article->id);?>" type="button"
class="btn btn-primary btn-xs" data-toggle="tooltip" data-placement="top"
data-original-title="编辑">
<i class="fa fa-pencil"></i>
</a>
<button oid="<?php echo $article->id;?>" type="button"
class="btn btn-danger btn-xs btn-delete" data-toggle="tooltip" data-placement="top"
data-original-title="删除">
<i class="fa fa-trash-o"></i>
</button>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$articles->render()}
</div>
</div>
</section>
<script type="text/javascript">
// 文档加载完毕之后,会进入该方法
$(function () {
$(".btn-delete").click(function () {
var _this = $(this);
var url = "delete";
var oid = _this.attr('oid');
showDialog("提示", "确定删除这篇文章吗?", function () {
// ajax post 方法
$.post(url, {id: oid}, function (res) {
var res = JSON.parse(res);
if (res.error == 1) {
// javascript 的默认弹出提示方法
alert(res.msg);
} else {
_this.remove();
$("#tr_" + oid).fadeOut();
}
});
});
});
});
//修改排序
function changeSort(id,sort) {
$.post("{:url('changeSort')}",{id:id,sort:sort},function (res) {
layer.msg(res.msg);
});
}
</script>
{layout name="public/layout_main"}
<link rel="stylesheet" href="/static/fileinput/css/fileinput.css">
<link rel="stylesheet" href="/static/bootstrap-select/css/bootstrap-select.min.css">
<style type="text/css">
.progress-bar{
text-align: center;
}
.dropdown-menu{
z-index: 100000;
}
</style>
<section class="wrapper">
<h3 class="">
<a href="<?php echo url('@admin/Guide/index')?>">
<i class="fa fa-angle-right"></i> <a href="{:url('admin/Guide/index')}">美行攻略</a> <i class="fa fa-angle-right"></i>
{if $article}
修改攻略
{else/}
发布攻略
{/if}
</a>
</h3>
<hr>
<?php if(isset($msg) && $msg):?>
<div class="row margin-bottom">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<?php echo $msg;?>
</div>
</div>
</div>
<?php endif;?>
<div class="row margin-bottom">
<div class="col-md-12">
<form name="myFrom" class="form-horizontal" enctype="multipart/form-data" method="POST" {if condition="$article"}action="{:url('admin/Guide/update',['id'=>$article['id']])}"{else/}action="{:url('admin/Guide/create')}"{/if} id="article-create-form">
<div class="form-group">
<label for="title" class="col-sm-2 control-label text-right">攻略标题</label>
<div class="col-sm-20 col-md-8 col-lg-6">
<input type="text" class="form-control validate[required]" value="{$article.title}" name="title" id="title" placeholder="请输入美行攻略的标题 ">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-2 control-label text-right">攻略描述</label>
<div class="col-sm-10 col-md-8 col-lg-6">
<textarea name="intro" id="" cols="30" rows="6" class="form-control" placeholder="请输入美行攻略的简单描述">{$article.intro}</textarea>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-2 control-label text-right" >攻略封面</label>
<div class="col-sm-20 col-md-8 col-lg-6">
<input type="hidden" name='old_poster' value="{$article.poster}">
<a href="{$article.poster}" target="_blank" data-fancybox="images" id="poster_view">
<img src="{$article.poster}" style="width:170px;margin-bottom:10px">
</a>
<input id="input-b1" name="poster" type="file">
<span class="form-group-tip"> * 尺寸建议:260px*190px </span>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-2 control-label text-right">攻略标签</label>
<div class="col-sm-20 col-md-8 col-lg-6">
<!--<input type="hidden" name="tags[]" id="tags" value="{$tags}">-->
<select class="selectpicker form-control" name="tags[]" multiple data-live-search="true">
{volist name="tag_list" name="tag_list" id="vo"}
<option {if condition="in_array($vo.id,$tag_arr)"}selected{/if} value="{$vo.id}">{$vo.name}</option>
{/volist}
</select>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-2 control-label text-right">攻略类型</label>
<div class="col-sm-20 col-md-8 col-lg-6">
<select class="form-control" name="type" id="post_type">
<option {if condition="$article.type == 1"}selected{/if} value="1">手动编写文章</option>
<option {if condition="$article.type == 2"}selected{/if} value="2">微信公众号文章</option>
</select>
</div>
</div>
<div class="form-group" id="href" style="display: none">
<label for="title" class="col-sm-2 control-label text-right">请输入url</label>
<div class="col-sm-20 col-md-8 col-lg-6">
{if condition="$article.type == 1"}
<input type="text" name="href" class="form-control">
{else/}
<input type="text" value="{$article.content}" name="href" class="form-control">
{/if}
<code>http:// + 网址 或 https:// + 网址</code>
</div>
</div>
<div class="form-group" id="content">
<label for="content" class="col-sm-2 control-label text-right">攻略详情</label>
<div class="col-sm-20 col-md-8 col-lg-6">
<!-- 加载编辑器的容器 -->
{if condition="$article.type == 1"}
<script id="post_container" name="content" type="text/plain" style="width: 100%">
{$article.content}
</script>
{else/}
<script id="post_container" name="content" type="text/plain" style="width: 100%">
</script>
{/if}
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="hidden" name="id" value="{$article.id??'';}">
<button type="submit" class="btn btn-success" id="btn-save">提交</button>
</div>
</div>
</form>
</div>
</div>
</section>
<!-- 文件上传和select插件 -->
<script type="text/javascript" src="/static/fileinput/js/fileinput.min.js"></script>
<script type="text/javascript" src="/static/fileinput/js/locales/zh.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/bootstrap-select.min.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/i18n/defaults-zh_CN.js"></script>
<!-- 编辑器配置文件 -->
<script src="/static/qiniu_ueditor143/ueditor.config.js"></script>
<script src="/static/qiniu_ueditor143/ueditor.all.min.js"></script>
<script src="/static/qiniu_ueditor143/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
$(function(){
// 即时显示封面图
$('#poster').change(function(e){
var file = e.target.files[0];
preview(file, 0);
});
var type = $("#post_type").val();
if(type == 1){
$("#content").show();
$("#href").hide();
}else{
$("#href").show();
$("#content").hide();
}
});
$("#post_type").change(function(){
var type = $(this).val();
if(type == 1){
$("#content").show();
$("#href").hide();
}else{
$("#href").show();
$("#content").hide();
}
});
// 初始化文件上传
var fileInput = $("#input-b1").fileinput({
language: 'zh',
showUpload:false, //是否显示上传按钮
showClose:false,
showRemove :false,
allowedFileExtensions: ['bmp','jpg','png','tif','gif','pcx','tga','exif','fpx','svg','cdr','pcd','dxf','ufo','eps','raw','WMF','webp'],//接收的文件后缀
})
$("#input-b1").change(function(data){
if(this.files.length>0){
$("#poster_view").hide();
}else{
$("#poster_view").show();
}
})
$("#input-b1").on("fileclear",function(event, data, msg){
$("#poster_view").show();
});
function setTags(){
var slected = $("#tags_select").val();
if(slected){
$("#tags").val(slected.toString());
}else{
$("#tags").val("");
}
}
UE.getEditor('post_container', {
//编辑区域大小
'initialFrameHeight' : '350',
'elementPathEnabled':false,
'autoHeight': false,
'autoHeightEnabled':false,
'autoFloatEnabled': false,
'iframeCssUrl': '/static/qiniu_ueditor143/themes/iframe.css',// 引入css
//定制菜单
'toolbars' : [
[
'fullscreen', 'source', 'undo', 'redo', '|',
'fontsize',
'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat',
'formatmatch', 'blockquote', 'pasteplain', '|',
'forecolor', 'backcolor', '|',
'lineheight', '|',
'indent', '|', 'insertimage', '|',
'justifyleft', //居左对齐
'justifyright', //居右对齐
'justifycenter', //居中对齐
'justifyjustify', //两端对齐
],
]
});
</script>
{layout name="public/layout_main"}
<style type="text/css">
.progress-bar{
text-align: center;
}
</style>
<section class="wrapper">
<h3 class="top-back">
<a href="<?php echo url('@admin/Post/index')?>">
<i class="fa fa-angle-left"></i> 编辑文章
</a>
</h3>
<hr>
<?php if(isset($msg) && $msg !== ''):?>
<div class="row margin-bottom">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<?php echo $msg;?>
</div>
</div>
</div>
<?php endif;?>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-horizontal" enctype="multipart/form-data" method="POST" id="robot-create-form">
<div class="form-group">
<label for="title" class="col-sm-2 control-label text-right">文章标题</label>
<div class="col-lg-8">
<input type="text" class="form-control validate[required]" name="title" id="title" value="<?php echo $article->title;?>">
</div>
</div>
<div class="form-group">
<label for="content" class="col-sm-2 control-label text-right">文章内容</label>
<div class="col-lg-8">
<!-- 加载编辑器的容器 -->
<script id="post_container" name="content" type="text/plain"><?php echo htmlspecialchars_decode($article->content); ?></script>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">提交</button>
</div>
</div>
</form>
</div>
</div>
</section>
<!-- 配置文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
var ue = UE.getEditor('post_container',{
// 图片上传配置路径
'serverUrl': "{:url('@admin/Ueditor/index')}",
'elementPathEnabled':false,
// autoHeight: true,
'autoHeightEnabled':false,
//编辑区域大小
'initialFrameHeight' : '300',
//定制菜单
'toolbars' : [
[
'fullscreen', 'source', 'undo', 'redo', '|',
'fontsize',
'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat',
'formatmatch', 'blockquote', 'pasteplain', '|',
'forecolor', 'backcolor', '|',
'lineheight', '|',
'indent', '|', 'insertimage', '|',
'justifyleft', //居左对齐
'justifyright', //居右对齐
'justifycenter', //居中对齐
'justifyjustify', //两端对齐
],
]
});
/*
* 初始化分类
*/
$(function () {
});
</script>
\ No newline at end of file
{layout name="public/layout_main"}
<style type="text/css">
.whitelink{
color: white;
text-decoration: none;
}
.whitelink:hover{
color: #ddd;
}
.nav-tabs{
margin-bottom: 15px;
}
</style>
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 数据概览</h3>
<hr>
<!--<ul class="nav nav-tabs">-->
<!--<li class="<?php if(input('tab')=='index'){echo 'active';} ?>">-->
<!--<a href="<?php echo url("@admin/Index/index", ['tab'=>'index'])?>">数据概览</a>-->
<!--</li>-->
<!--<li class="<?php if(input('tab')=='visitor'){echo 'active';} ?>">-->
<!--<a href="<?php echo url("@admin/Index/index", ['tab'=>'visitor'])?>">访客数据</a>-->
<!--</li>-->
<!--<li class="<?php if(input('tab')=='miniapp'){echo 'active';} ?>">-->
<!--<a href="<?php echo url("@admin/Index/index", ['tab'=>'miniapp'])?>">小程序数据</a>-->
<!--</li>-->
<!--</ul>-->
<div class="row margin-bottom">
<div class="col-md-4">
<div class="bg-color-primary padding-lg text-center">
<div class="row">
<div class="col-md-6">
<div class="margin-bottom-xs">
<i class="fa fa-user-circle-o fa-3x text-align-bottom"></i>
<span class="padding-left-xs text-xxl text-align-bottom">
{$user_num}
</span>
</div>
<span class="text-lg">
<a class="whitelink" href="/admin/User/index">用户总数</a>
</span>
</div>
<div class="col-md-6">
<div class="margin-bottom-xs">
<i class="fa fa-mobile fa-3x text-align-bottom"></i>
<span class="padding-left-xs text-xxl text-align-bottom">
{$user_num_today}
</span>
</div>
<span class="text-lg">
<a class="whitelink" href="/admin/User/index">今日新增用户数</a>
</span>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="bg-color-success padding-lg text-center">
<div class="row">
<div class="col-md-6" id="div_wxqun" style="cursor: pointer;">
<div class="margin-bottom-xs">
<i class="fa fa-calendar-plus-o fa-3x text-align-bottom"></i>
<span class="padding-left-xs text-xxl text-align-bottom">
{$order_num}
</span>
</div>
<span class="text-lg">
<a class="whitelink" href="/admin/order/index">订单总数</a>
</span>
</div>
<div class="col-md-6">
<div class="margin-bottom-xs">
<i class="fa fa-book fa-3x text-align-bottom"></i>
<span class="padding-left-xs text-xxl text-align-bottom">
{$order_num_today}
</span>
</div>
<span class="text-lg">
<a class="whitelink" href="/admin/order/index">今日新增订单数</a>
</span>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="bg-color-warning padding-lg text-center">
<div class="row">
<div class="col-md-6" id="div_wxqun" style="cursor: pointer;">
<div class="margin-bottom-xs">
<i class="fa fa-calendar-plus-o fa-3x text-align-bottom"></i>
<span class="padding-left-xs text-xxl text-align-bottom">
{$wait_num_r}
</span>
</div>
<span class="text-lg">
<a class="whitelink" href="{:url('/admin/order/refund?status=1')}">退款待审核</a>
</span>
</div>
<div class="col-md-6">
<div class="margin-bottom-xs">
<i class="fa fa-book fa-3x text-align-bottom"></i>
<span class="padding-left-xs text-xxl text-align-bottom">
{$wait_num_c}
</span>
</div>
<span class="text-lg">
<a class="whitelink" href="{:url('/admin/order/comment?status=1')}">评论待审核</a>
</span>
</div>
</div>
</div>
</div>
</div>
</section>
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 日志记录</h3>
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline" method="GET" id="search_from">
<div class="form-group">
<input type="text" class="form-control" name="admin" id="admin" placeholder="管理员" value="<?php echo input('get.admin');?>">
<input type="text" class="form-control" name="category" id="category" placeholder="标签" value="<?php echo input('get.category');?>">
</div>
<button type="submit" class="btn btn-default margin-left">搜索</button>
</form>
</div>
</div>
<ul class="nav nav-tabs">
<li class="<?php if(input('level')=='info'){echo 'active';} ?>">
<a href="<?php echo url("@admin/Log/index", ['level'=>'info'])?>">信息日志</a>
</li>
<li class="<?php if(input('level')=='debug'){echo 'active';} ?>">
<a href="<?php echo url("@admin/Log/index", ['level'=>'debug'])?>">调试日志</a>
</li>
<li class="<?php if(input('level')=='error'){echo 'active';} ?>">
<a href="<?php echo url("@admin/Log/index", ['level'=>'error'])?>">错误日志</a>
</li>
</ul>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-hover table-striped">
<thead>
<tr>
<th>#</th>
<th>级别</th>
<th>标签</th>
<th>内容</th>
<th>客户端</th>
<th>管理员</th>
<th>时间</th>
</tr>
</thead>
<tbody>
<?php foreach($items as $item):?>
<tr id="tr_<?php echo $item->id;?>">
<td><?php echo $item->id;?></td>
<td>
<?php echo $item->level_text;?>
</td>
<td>
<?php echo $item->category;?>
</td>
<td style="max-width:240px;word-break:break-all">
<?php echo $item->message;?>
</td>
<td style="max-width:240px;word-break:break-all">
<?php echo $item['visitor'];?>
</td>
<td style="max-width:240px;word-break:break-all">
<?php
if($item->admin){
echo $item->admin->username;
}else{
echo '来自API';
}
?>
</td>
<td><?php echo $item['created_at'];?></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$items->render()}
</div>
</div>
</section>
<script type="text/javascript">
$(function(){
// 右侧详情
});
</script>
{layout name="public/layout_main"}
<link rel="stylesheet" href="/static/datetimepicker/css/bootstrap-datetimepicker.min.css">
<link rel="stylesheet" href="/static/validation/css/validationEngine.jquery.css">
<section class="wrapper">
<h3 class="top-back">
<a href="<?php echo url('@admin/Miniapp/index')?>">
<i class="fa fa-angle-left"></i>
<?php echo isset($model)?'修改小程序':'添加小程序';?>
</a>
</h3>
<hr>
<!-- 错误信息:php需使用 $this->assign('errmsg', '错误信息'); 来设置显示内容! -->
<?php if(isset($errmsg)):?>
<div class="row margin-bottom">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<?php echo $errmsg;?>
</div>
</div>
</div>
<?php endif;?>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-horizontal" method="POST" action="<?php if(ACTION_NAME == 'update'){ }else{ echo url('@admin/Miniapp/create'); }?>" id="create-form" enctype="multipart/form-data">
<div class="form-group">
<label for="name" class="col-sm-2 control-label text-right">小程序名</label>
<div class="col-sm-10 col-md-8 col-lg-6">
<input type="text" class="form-control validate[required]" name="name" id="name" placeholder="小程序名" value="<?php echo isset($model)?$model->name:'';?>">
</div>
</div>
<div class="form-group">
<label for="subject" class="col-sm-2 control-label text-right">简介</label>
<div class="col-sm-10 col-md-8 col-lg-6">
<input type="text" class="form-control validate[required]" name="subject" id="subject" placeholder="简介" value="<?php echo isset($model)?$model->subject:'';?>">
</div>
</div>
<div class="form-group">
<label for="desc" class="col-sm-2 control-label text-right">封面图</label>
<div class="col-sm-10 col-md-8 col-lg-6">
<!-- 1.上传ID和Input ID需在jq中添加事件 2.预览的类属性imgpreview不能缺失 -->
<div class="input-group">
<span class="input-group-addon pointer" id="upbtn_poster">上传</span>
<input type="text" class="form-control validate[required,custom[url]] imginpunt" name="poster" id="poster" placeholder="上传图片或输入图片链接" value="<?php echo isset($model)?$model->poster:'';?>">
<div class="input-group-addon imgpreview">
<a href="<?php echo isset($model)?$model->poster:'';?>" target="_blank" data-fancybox="images">预览</a>
</div>
</div>
</div>
</div>
<div class="form-group">
<a href="http://www.114la.com/other/rgb.htm" target="view_window">
<label class="col-sm-2 control-label text-right">按钮颜色</label>
</a>
<div class="col-sm-10 col-md-8 col-lg-6">
<input type="text" class="form-control validate[required]" name="btn_color" id="btn_color" placeholder="按钮颜色,点击label选择颜色" value="<?php echo isset($model)?$model->btn_color:'';?>"></input>
</div>
</div>
<div class="form-group">
<a href="http://www.114la.com/other/rgb.htm" target="view_window">
<label class="col-sm-2 control-label text-right">标题颜色</label>
</a>
<div class="col-sm-10 col-md-8 col-lg-6">
<input type="text" class="form-control validate[required]" name="title_color" id="title_color" placeholder="标题颜色,点击label选择颜色" value="<?php echo isset($model)?$model->title_color:'';?>"></input>
</div>
</div>
<div class="form-group">
<label for="desc" class="col-sm-2 control-label text-right">图标</label>
<div class="col-sm-10 col-md-8 col-lg-6">
<!-- 1.上传ID和Input ID需在jq中添加事件 2.预览的类属性imgpreview不能缺失 -->
<div class="input-group">
<span class="input-group-addon pointer" id="upbtn_icon">上传</span>
<input type="text" class="form-control validate[required,custom[url]] imginpunt" name="icon" id="icon" placeholder="上传图片或输入图片链接" value="<?php echo isset($model)?$model->icon:'';?>">
<div class="input-group-addon imgpreview">
<a href="<?php echo isset($model)?$model->icon:'';?>" target="_blank" data-fancybox="images">预览</a>
</div>
</div>
</div>
</div>
<div class="form-group">
<label for="desc" class="col-sm-2 control-label text-right">小程序码</label>
<div class="col-sm-10 col-md-8 col-lg-6">
<!-- 1.上传ID和Input ID需在jq中添加事件 2.预览的类属性imgpreview不能缺失 -->
<div class="input-group">
<span class="input-group-addon pointer" id="upbtn_qrcode">上传</span>
<input type="text" class="form-control validate[required,custom[url]] imginpunt" name="qrcode" id="qrcode" placeholder="上传图片或输入图片链接" value="<?php echo isset($model)?$model->qrcode:'';?>">
<div class="input-group-addon imgpreview">
<a href="<?php echo isset($model)?$model->qrcode:'';?>" target="_blank" data-fancybox="images">预览</a>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-success">提交</button>
</div>
</div>
</form>
</div>
</div>
</section>
<script src="/static/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script src="/static/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="/static/validation/js/jquery.validationEngine-zh_CN.js"></script>
<script src="/static/validation/js/jquery.validationEngine.js"></script>
<script src="/static/plupload/moxie.min.js" type="text/javascript"></script>
<script src="/static/plupload/plupload.min.js" type="text/javascript"></script>
<script src="/static/qiniu/qiniu.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$('#create-form').validationEngine('attach', {
promptPosition: 'centerRight',
binded: true,
scroll: true
});
// 设置要上传图片的input输入框
setImageUp('upbtn_poster', 'poster');
setImageUp('upbtn_icon', 'icon');
setImageUp('upbtn_qrcode', 'qrcode');
// 图片输入框改变,则改变预览的图片地址
$('.imginpunt').on('input', function(){
$(this).siblings('.imgpreview').children('a').attr('href', $(this).val());
});
})
</script>
{layout name="public/layout_main"}
<section class="wrapper">
<h3>
<i class="fa fa-angle-right"></i> 小程序列表
</h3>
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline" method="GET" id="search_from">
<div class="form-group">
<input type="text" class="form-control" name="name" id="name" placeholder="名称" value="<?php echo input('get.name');?>">
</div>
<button type="submit" class="btn btn-primary margin-left">搜索</button>
<a href="<?=url('admin/Miniapp/create')?>" class="btn btn-success margin-left">创建小程序</a>
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>#</th>
<th>名称</th>
<th>简介</th>
<th>封面图</th>
<th>按钮颜色</th>
<th>标题颜色</th>
<th>图标</th>
<th>小程序码</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach($items as $item):?>
<tr id="tr_<?php echo $item->id;?>">
<td><?php echo $item->id;?></td>
<td>
<?php echo $item->name;?>
</td>
<td>
<?php echo $item->subject;?>
</td>
<td>
<a href="<?=$item->poster?>" target="_blank" data-fancybox="images">
<img src="<?=$item->poster?>" width='50' height='50' />
</a>
</td>
<td>
<?php echo $item->btn_color;?>
</td>
<td>
<?php echo $item->title_color;?>
</td>
<td>
<a href="<?=$item->icon?>" target="_blank" data-fancybox="images">
<img src="<?=$item->icon?>" width='50' height='50' />
</a>
</td>
<td>
<a href="<?=$item->qrcode?>" target="_blank" data-fancybox="images">
<img src="<?=$item->qrcode?>" width='50' height='50' />
</a>
</td>
<td>
<a href="<?=url('@admin/Miniapp/update', ['id'=>$item->id])?>" type="button" class="btn btn-primary btn-xs btn-delete" oid="<?=$item['id']?>"><i class="fa fa-pencil"></i></a>
/
<a href="javascript:;" type="button" class="btn btn-danger btn-xs btn-delete" oid="<?=$item['id']?>"><i class="fa fa-trash"></i></a>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$items->render()}
</div>
</div>
</section>
{include file="public/course_detail" /}
<script type="text/javascript">
$(function(){
$('#sel_type').change(function(){
$("#search_from").submit();
});
$('#sel_catalog').change(function(){
$("#search_from").submit();
});
// 课程分类
$.post('/admin/Course/ajax_course_catalogs', {}, function(res){
res = $.parseJSON(res);
if (res.code==0) {
var html = '';
var catalog = "<?=input('catalog')?>";
var selected;
for (var i = 0; i < res.data.length; i++) {
if (res.data[i].id==catalog) {
selected = "selected='selected'";
}else{
selected = "";
}
html += "<option "+selected+ "value="+res.data[i].id+">"+res.data[i].title+"</option>";
}
$('#sel_catalog').append(html);
}else{
alert(res.msg);
}
});
// 右侧详情
$('.btn-detail').unbind('click').bind('click', function (event) {
event.stopPropagation();
event.preventDefault();
document.getElementById('right-detail-content').innerHTML = "";
var url = "/admin/Course/read";
var oid = $(this).attr('oid');
showRightDetail(function () {
$.get(url + "/id/" + oid, function (res) {
var res = JSON.parse(res);
if (res.error) {
new PNotify({
title: '提示',
text: res.msg,
'type': 'error'
});
} else {
var html = template('course', res.data);
document.getElementById('right-detail-content').innerHTML = html;
}
});
});
});
$(".btn-delete").click(function(){
var _this = $(this);
var url = "ajax_delete";
var oid = _this.attr('oid');
showDialog("提示", "确定删除此小程序吗?", function () {
// ajax post 方法
$.post(url, {id:oid}, function (res) {
console.log(res);
var res = JSON.parse(res);
if (res.error == 1) {
// javascript 的默认弹出提示方法
alert(res.msg);
} else {
_this.remove();
$("#tr_"+oid).fadeOut();
}
});
});
});
});
</script>
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 评论审核</h3>
<!-- 分割线 -->
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline" method="GET" id="order-search" action="<?php echo url('@admin/order/comment')?>">
<div class="form-group">
<select name="status" class="form-control" id="status">
<option value="-1" {if condition="$status=='-1'"}selected{/if}>全部审核状态</option>
<option value="1" {if condition="$status=='1'"}selected{/if}>审核中</option>
<option value="2" {if condition="$status=='2'"}selected{/if}>审核通过</option>
<option value="3" {if condition="$status=='3'"}selected{/if}>审核失败</option>
</select>
</div>
<!--<button type="submit" class="btn btn-primary">搜索</button>-->
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>ID</th>
<th>项目信息</th>
<th>用户信息</th>
<th>评分</th>
<th>评论内容</th>
<th>审核状态</th>
<th>审核</th>
</tr>
</thead>
<tbody>
{volist name="$comment_list" id="vo" key="k" empty="暂时没有数据"}
<tr>
<td>{$vo.id}</td>
<td>
{if condition="$vo.project"}
<a href="{$vo.project.poster}" target="_blank" data-fancybox="images">
<img src="{$vo.project.poster}" width='100'>
</a>
<p style="padding:0;margin:0;">{$vo.project.title}</p>
{/if}
</td>
<td>
<p style="padding:0;margin:0;text-align:center">{$vo.user.nickname}</p>
<p style="padding:0;margin:0;text-align:center">{$vo.user.phone}</p>
<p style="padding:0;margin:0;text-align:center;color:#f60">
{if condition="$vo.user.is_vip == 1"}
{/if}
</p>
</td>
<td>
{$vo.grade}分
</td>
<td>
<div style="width:250px;">{$vo.content}</div>
</td>
<td>
<span style="color:{$vo.status_str.color}">
{$vo.status_str.name}
</span>
</td>
<td>
<a href="javascript:" class="btn btn-primary btn-xs check-btn" data-id="{$vo.id}" {if $vo[
'status']!=1}disabled="disabled"{/if}>审核</a>
</td>
</tr>
{/volist}
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$comment_list->render()}
</div>
</div>
</section>
<div class="modal fade" id="mymodal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
评论审核
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</div>
<div class="modal-body" style="text-align: center">
<input type="radio" name="state" id="state-1" value="2">
<label for="state-1" class="margin-right">
审核通过
</label>
<input type="radio" name="state" id="state-2" value="3">
<label for="state-2">审核不通过</label>
</div>
<div class="modal-footer">
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">取消</button>
<button class="btn btn-primary" id="set_status">确定</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
// 文档加载完毕之后,会进入该方法
$(function(){
$(".btn-delete").click(function(){
var _this = $(this);
var url = "delete";
var oid = _this.attr('oid');
showDialog("提示", "确定删除这篇文章吗?", function () {
// ajax post 方法
$.post(url, {id:oid}, function (res) {
var res = JSON.parse(res);
if (res.error == 1) {
// javascript 的默认弹出提示方法
alert(res.msg);
} else {
_this.remove();
$("#tr_"+oid).fadeOut();
}
});
});
});
$("#status").change(function(){
$("#order-search").submit();
});
$(".check-btn").click(function(){
comment_id = $(this).data('id');
$("#mymodal").modal();
});
$("#set_status").click(function(){
var status = $("input[name='state']:checked").val();
if(status) {
$.post("{:url('admin/order/commentStatus')}", {id: comment_id, status: status}, function (data) {
if (data['code'] == 1) {
alert(data['msg']);
window.location.reload();
}
});
$("#mymodal").modal('hide');
}else{
alert('请选择要进行的审核操作');
}
});
});
</script>
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 订单管理</h3>
<!-- 分割线 -->
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline pull-left" method="GET" id="order-search" action="<?php echo url('@admin/order/index')?>">
<div class="form-group margin-right">
<input class="form-control" type="text" name="title" value="{:input('title')}" placeholder="活动名称"/>
</div>
<div class="form-group margin-right">
<select name="status" class="form-control" id="status">
<option value="-1" {if condition="$status=='-1'"}selected{/if}>全部订单状态</option>
<option value="0" {if condition="$status=='0'"}selected{/if}>未付款</option>
<option value="1" {if condition="$status=='1'"}selected{/if}>进行中</option>
<option value="2" {if condition="$status=='2'"}selected{/if}>待评价</option>
<option value="3" {if condition="$status=='3'"}selected{/if}>已完成</option>
</select>
</div>
<div class="form-group margin-right">
<select name="type" class="form-control" id="type">
<option value="">全部订单类型</option>
<option value="1" {if condition="input('type')=='1'"}selected{/if}>活动报名订单</option>
<option value="2" {if condition="input('type')=='2'"}selected{/if}>购买会员卡订单</option>
</select>
</div>
<div class="form-group margin-right">
<label for="">下单时间:</label>
<input class="form-control" type="date" name="start_time" id="start_time" value="{:input('start_time')}" placeholder="起始"/>
--
<input class="form-control" type="date" name="end_time" id="end_time" value="{:input('end_time')}" placeholder="结束"/>
</div>
<button type="submit" class="btn btn-primary">搜索</button>
</form>
<button class="btn btn-success margin-left" id="output">导出</button>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>ID</th>
<th>订单标题</th>
<th>订单来源</th>
<th>项目信息</th>
<th>用户信息</th>
<th>订单总价</th>
<th>订单状态</th>
<th>地址</th>
<th>退款状态</th>
<th>评论状态</th>
<th>下单时间</th>
</tr>
</thead>
<tbody>
{volist name="order_list" id="vo" key="k" empty="暂时没有数据"}
<tr>
<td>{$vo.id}</td>
<td>{$vo.title}</td>
<td>
{if condition="$vo.type == 1"}
活动报名
{else/}
购买会员卡
{/if}
</td>
<td>
{if condition="$vo.project_poster"}
<a href="{$vo.project_poster}" target="_blank" data-fancybox="images">
<img src="{$vo.project_poster}" width='100'>
</a>
<p style="padding:0;margin:0;">{$vo.project_title}</p>
{/if}
</td>
<td>
<p style="padding:0;margin:0;text-align:center">{$vo.user_info.nickname}</p>
<p style="padding:0;margin:0;text-align:center">{$vo.user_info.phone}</p>
<p style="padding:0;margin:0;text-align:center;color:#f60">
{if condition="$vo.user_info.is_vip == 1"}
{/if}
</p>
</td>
<td>{$vo.total_fee}</td>
<!--订单状态-->
<td>
<span style="color:{$vo.status_name.color}">{$vo.StatusAdminText}</span>
</td>
<td>
{$vo.extras['address']??''}
</td>
<td>
{if condition="$vo.is_refund == 0"}
无退款
{elseif condition="$vo.is_refund == 1"/}
<a href="{:url('/admin/order/refund?id='.$vo.linkrefund.id)}">退款申请中</a>
{elseif condition="$vo.is_refund == 2"/}
<a href="{:url('/admin/order/refund?id='.$vo.linkrefund.id)}">退款失败</a>
{elseif condition="$vo.is_refund == 3"/}
<a href="{:url('/admin/order/refund?id='.$vo.linkrefund.id)}">退款成功</a>
{/if}
<!--0-无退款申请,1-有退款申请,2-退款失败,3-退款成功-->
</td>
<!--无退款、退款申请中、退款失败、退款成功;无评论、评论审核中、评论失败、评论成功。-->
<td>
{if condition="$vo.is_comment == 0"}
无评论
{elseif condition="$vo.is_comment == 1"/}
<a href="{:url('/admin/order/comment?id='.$vo.linkcomment.id)}">评论审核中</a>
{elseif condition="$vo.is_comment == 2"/}
<a href="{:url('/admin/order/comment?id='.$vo.linkcomment.id)}">评论失败</a>
{elseif condition="$vo.is_comment == 3"/}
<a href="{:url('/admin/order/comment?id='.$vo.linkcomment.id)}">评论成功</a>
<!--0-无评论,1-审核中,2-未通过审核,3-评论成功-->
{/if}
</td>
<td>{$vo.created_at}</td>
</tr>
{/volist}
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$order_list->render()}
</div>
</div>
</section>
<script type="text/javascript">
// 文档加载完毕之后,会进入该方法
$(function(){
// $(".btn-delete").click(function(){
// var _this = $(this);
// var url = "delete";
// var oid = _this.attr('oid');
// showDialog("提示", "确定删除这篇文章吗?", function () {
// // ajax post 方法
// $.post(url, {id:oid}, function (res) {
// var res = JSON.parse(res);
// if (res.error == 1) {
// // javascript 的默认弹出提示方法
// alert(res.msg);
// } else {
// _this.remove();
// $("#tr_"+oid).fadeOut();
// }
// });
// });
// });
$("#output").click(function () {
$(this).attr("disabled",true);
// $nickname = input('get.nickname');
// $is_vip = input('get.is_vip');
// $start_time = input('get.start_time');
// $end_time = input('get.end_time');
var status = $("#status").val();
var type = $("#type").val();
var start_time = $("#start_time").val();
var end_time = $("#end_time").val();
window.location.href="{:url('admin/order/orderOutput')}"+'?status='+status+'&type='+type+'&start_time='+start_time+'&end_time='+end_time;
$(this).removeAttr('disabled');
});
});
</script>
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 退款审核</h3>
<!-- 分割线 -->
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline" method="GET" id="order-search" action="<?php echo url('@admin/order/refund')?>">
<div class="form-group">
<select name="status" class="form-control" id="status">
<option value="-1" {if condition="$status=='-1'" }selected{
/if}>全部退款状态</option>
<option value="1" {if condition="$status=='1'" }selected{
/if}>申请中</option>
<option value="2" {if condition="$status=='2'" }selected{
/if}>退款成功</option>
<option value="3" {if condition="$status=='3'" }selected{
/if}>退款失败</option>
</select>
</div>
<!--<button type="submit" class="btn btn-primary">搜索</button>-->
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>ID</th>
<th>订单标题</th>
<th>订单来源</th>
<th>项目信息</th>
<th>用户信息</th>
<th>订单总价</th>
<th>微信支付状态</th>
<th>退款状态</th>
<th width="150">审核</th>
</tr>
</thead>
<tbody>
{volist name="$refund_list" id="vo" key="k" empty="暂时没有数据"}
<tr>
<td>{$vo.id}</td>
<td>{$vo.order.title}</td>
<td>
{if condition="$vo.order.type == 1"}
活动报名订单
{else/}
购买会员卡订单
{/if}
</td>
<td>
{if condition="$vo.order.project"}
<a href="{$vo.order.project.poster}" target="_blank" data-fancybox="images">
<img src="{$vo.order.project.poster}" width='100'>
</a>
<p style="padding:0;margin:0;">{$vo.order.project.title}</p>
{/if}
<!--<img src="{$vo.order.project.poster}" style="width:70px;display:block;margin:0 auto;" alt="">-->
<!--<p style="padding:0;margin:0;text-align:center">{$vo.order.project.title}</p>-->
</td>
<td>
<p style="padding:0;margin:0;text-align:center">{$vo.order.user_info.nickname}</p>
<p style="padding:0;margin:0;text-align:center">{$vo.order.user_info.phone}</p>
<p style="padding:0;margin:0;text-align:center;color:#f60">
{if condition="$vo.order.user_info.is_vip == 1"}
{/if}
</p>
</td>
<td>{$vo.order.total_fee}</td>
<!--订单状态-->
<td>
{$vo.order.trade_status}
</td>
<td>
<span style="color:{$vo.status_str.color}">
{$vo.status_str.name}
</span>
</td>
<td>
<!--{if condition="$vo.status == 1"}-->
<!--<a href="javascript:" class="btn btn-primary btn-xs check-btn" data-id="{$vo.id}">审核</a>-->
<!--{/if}-->
<div style="width:100%;display:flex;justify-content: space-around;">
<button data-id="{$vo['id']}" class="pass-refund btn btn-xs btn-primary " {if $vo[
'status']!=1}disabled="disabled"{/if}>退款</button>
<button data-id="{$vo['id']}" class="no-refund btn btn-xs btn-warning " {if $vo[
'status']!=1}disabled="disabled"{/if}>驳回</button>
</div>
</td>
</tr>
{/volist}
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$refund_list->render()}
</div>
</div>
<div class="modal fade" id="mymodal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
退款审核
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</div>
<div class="modal-body" style="text-align: center">
<input type="radio" name="state" id="state-1" value="2">
<label for="state-1" class="margin-right">
退款
</label>
<input type="radio" name="state" id="state-2" value="3">
<label for="state-2">驳回退款申请</label>
</div>
<div class="modal-footer">
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">取消</button>
<button class="btn btn-primary" id="set_status">确定</button>
</div>
</div>
</div>
</div>
</section>
<script type="text/javascript">
$("#status").change(function () {
$("#order-search").submit();
});
// 文档加载完毕之后,会进入该方法
$(function () {
$(".btn-delete").click(function () {
var _this = $(this);
var url = "delete";
var oid = _this.attr('oid');
showDialog("提示", "确定删除这篇文章吗?", function () {
// ajax post 方法
$.post(url, {id: oid}, function (res) {
var res = JSON.parse(res);
if (res.error == 1) {
// javascript 的默认弹出提示方法
alert(res.msg);
} else {
_this.remove();
$("#tr_" + oid).fadeOut();
}
});
});
});
$(".check-btn").click(function () {
comment_id = $(this).data('id');
$("#mymodal").modal();
});
$("#set_status").click(function () {
var status = $("input[name='state']:checked").val();
if (status) {
$.post("{:url('admin/order/refundStatus')}", {id: comment_id, status: status}, function (data) {
if (data['code'] == 1) {
alert(data['msg']);
window.location.reload();
}
});
$("#mymodal").modal();
} else {
alert('请选择要进行的审核操作');
}
});
//审核通过
$('.pass-refund').on('click', function () {
var that = this;
layer.confirm("您确定退款吗?", {icon: 3, title:'提示'}, function(index){
var id = $(that).attr('data-id');
var load = layer.load(2);
$.post("{:url('passRefund')}",{id:id},function(res){
layer.close(load);
if(res.code==0){
layer.msg(res.msg);
$(that).attr('disabled','disabled');
$(that).next().attr('disabled','disabled');
}else{
layer.msg(res.msg);
}
},'json');
layer.close(index);
});
});
//驳回
$('.no-refund').on('click', function () {
var that = this;
layer.confirm("您确定驳回退款吗?", {icon: 3, title:'提示'}, function(index){
var id = $(that).attr('data-id');
var load = layer.load(2);
$.post("{:url('noPassRefund')}",{id:id},function(res){
layer.close(load);
if(res.code==0){
layer.msg(res.msg);
$(that).attr('disabled','disabled');
$(that).prev().attr('disabled','disabled');
}else{
layer.msg(res.msg);
}
},'json');
layer.close(index);
});
});
});
</script>
{layout name="public/layout_main"}
<link rel="stylesheet" href="/static/fileinput/css/fileinput.css">
<link rel="stylesheet" href="/static/bootstrap-select/css/bootstrap-select.min.css">
<style type="text/css">
.progress-bar{
text-align: center;
}
.dropdown-menu{
z-index: 100000;
}
</style>
<section class="wrapper">
<h3 class="">
<a href="<?php echo url('@admin/Post/index')?>">
<i class="fa fa-angle-right"></i> <a href="{:url('admin/post/index')}">文章管理</a> <i class="fa fa-angle-right"></i> 发布文章
</a>
</h3>
<hr>
<?php if(isset($msg) && $msg):?>
<div class="row margin-bottom">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<?php echo $msg;?>
</div>
</div>
</div>
<?php endif;?>
<div class="row margin-bottom">
<div class="col-md-12">
<form name="myFrom" class="form-horizontal" enctype="multipart/form-data" method="POST" action="<?php echo url("@admin/Post/create")?>" id="article-create-form">
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">文章标题</label>
<div class="col-lg-10">
<input type="text" class="form-control validate[required]" name="title" id="title" placeholder="文章标题 ">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right" >文章封面</label>
<div class="col-lg-10">
<input id="input-b1" name="poster" type="file">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">文章标签</label>
<div class="col-lg-10">
<select class="selectpicker form-control" name="tags" multiple data-live-search="true">
{volist name="tag_list" name="tag_list" id="vo"}
<option value="{$vo.id}">{$vo.name}</option>
{/volist}
</select>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-1 control-label text-right">文章类型</label>
<div class="col-lg-10">
<select class="form-control" name="type" id="post_type">
<option value="1">手动编写文章</option>
<option value="2">链接到网络文章</option>
</select>
</div>
</div>
<div class="form-group" id="href" style="display: none">
<label for="title" class="col-sm-1 control-label text-right">请输入url</label>
<div class="col-lg-10">
<input type="text" name="href" class="form-control">
<code>http:// + 网址 或 https:// + 网址</code>
</div>
</div>
<div class="form-group" id="content">
<label for="content" class="col-sm-1 control-label text-right">文章内容</label>
<div class="col-lg-10">
<!-- 加载编辑器的容器 -->
<script id="post_container" name="content" type="text/plain" style="width: 100%">
</script>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-1 col-sm-10">
<button type="submit" class="btn btn-default" id="btn-save">提交</button>
</div>
</div>
</form>
</div>
</div>
</section>
<!-- 文件上传和select插件 -->
<script type="text/javascript" src="/static/fileinput/js/fileinput.min.js"></script>
<script type="text/javascript" src="/static/fileinput/js/locales/zh.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/bootstrap-select.min.js"></script>
<script type="text/javascript" src="/static/bootstrap-select/js/i18n/defaults-zh_CN.js"></script>
<!-- 配置文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
$(function(){
// 即时显示封面图
$('#poster').change(function(e){
var file = e.target.files[0];
preview(file, 0);
});
});
$("#post_type").change(function(){
var type = $(this).val();
if(type == 1){
$("#content").show();
$("#href").hide();
}else{
$("#href").show();
$("#content").hide();
}
});
// 初始化文件上传
$("#input-b1").fileinput({
language: 'zh',
showUpload:false, //是否显示上传按钮
allowedFileExtensions: ['bmp','jpg','png','tif','gif','pcx','tga','exif','fpx','svg','cdr','pcd','dxf','ufo','eps','raw','WMF','webp'],//接收的文件后缀
})
UE.getEditor('post_container', {
//编辑区域大小
'initialFrameHeight' : '350',
'elementPathEnabled':false,
'autoHeight': true,
'autoHeightEnabled':true,
'autoFloatEnabled': true,
'iframeCssUrl': '/static/ueditor/themes/iframe.css',// 引入css
//定制菜单
'toolbars' : [
[
'fullscreen', 'source', 'undo', 'redo', '|',
'fontsize',
'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat',
'formatmatch', 'blockquote', 'pasteplain', '|',
'forecolor', 'backcolor', '|',
'lineheight', '|',
'indent', '|', 'insertimage', '|',
'justifyleft', //居左对齐
'justifyright', //居右对齐
'justifycenter', //居中对齐
'justifyjustify', //两端对齐
],
]
});
</script>
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 文章管理</h3>
<!-- 分割线 -->
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline" method="GET" action="<?php echo url('@admin/Post/index')?>">
<div class="form-group margin-right">
<label for="title">文章标题</label>
<input class="form-control" type="text" name="title" id="title" value="<?php echo input('title');?>" />
</div>
<button type="submit" class="btn btn-primary">搜索</button>
<a href='<?php echo url("@admin/Post/create")?>' type="button" class="btn btn-success" style="margin-left:30px;">
发布文章
</a>
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>#</th>
<th>文章标题</th>
<th>封面</th>
<th>发布人</th>
<th>发布时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($articles as $k => $article):?>
<tr id="tr_<?php echo $article->id;?>">
<td><?php echo $article->id;?></td>
<td style="max-width:450px;">
{if condition="$article.type == 1"}
<a href="<?php echo url('@mob/Post/read', 'id='.$article->id);?>/" target='_blank'>
<?php echo $article->title;?>
</a>
{else/}
<a href="{$article->content}" target='_blank'>
<?php echo $article->title;?>
</a>
{/if}
</td>
<td><img style="width: 170px" src="{$article->poster}" alt=""></td>
<td><?php echo $article->admin->username;?></td>
<td><?php echo $article->created_at;?></td>
<td style="min-width:100px;">
<a href="<?php echo url('@admin/Post/update', 'id='.$article->id);?>" type="button" class="btn btn-primary btn-xs" data-toggle="tooltip" data-placement="top" data-original-title="编辑">
<i class="fa fa-pencil"></i>
</a>
<button oid="<?php echo $article->id;?>" type="button" class="btn btn-danger btn-xs btn-delete" data-toggle="tooltip" data-placement="top" data-original-title="删除">
<i class="fa fa-trash-o"></i>
</button>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$articles->render()}
</div>
</div>
</section>
<script type="text/javascript">
// 文档加载完毕之后,会进入该方法
$(function(){
$(".btn-delete").click(function(){
var _this = $(this);
var url = "delete";
var oid = _this.attr('oid');
showDialog("提示", "确定删除这篇文章吗?", function () {
// ajax post 方法
$.post(url, {id:oid}, function (res) {
var res = JSON.parse(res);
if (res.error == 1) {
// javascript 的默认弹出提示方法
alert(res.msg);
} else {
_this.remove();
$("#tr_"+oid).fadeOut();
}
});
});
});
});
</script>
{layout name="public/layout_main"}
<style type="text/css">
.progress-bar{
text-align: center;
}
</style>
<section class="wrapper">
<h3 class="top-back">
<a href="<?php echo url('@admin/Post/index')?>">
<i class="fa fa-angle-left"></i> 编辑文章
</a>
</h3>
<hr>
<?php if(isset($msg) && $msg !== ''):?>
<div class="row margin-bottom">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<?php echo $msg;?>
</div>
</div>
</div>
<?php endif;?>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-horizontal" enctype="multipart/form-data" method="POST" id="robot-create-form">
<div class="form-group">
<label for="title" class="col-sm-2 control-label text-right">文章标题</label>
<div class="col-lg-8">
<input type="text" class="form-control validate[required]" name="title" id="title" value="<?php echo $article->title;?>">
</div>
</div>
<div class="form-group">
<label for="content" class="col-sm-2 control-label text-right">文章内容</label>
<div class="col-lg-8">
<!-- 加载编辑器的容器 -->
<script id="post_container" name="content" type="text/plain"><?php echo htmlspecialchars_decode($article->content); ?></script>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">提交</button>
</div>
</div>
</form>
</div>
</div>
</section>
<!-- 配置文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
var ue = UE.getEditor('post_container',{
// 图片上传配置路径
'serverUrl': "{:url('@admin/Ueditor/index')}",
'elementPathEnabled':false,
// autoHeight: true,
'autoHeightEnabled':false,
//编辑区域大小
'initialFrameHeight' : '300',
//定制菜单
'toolbars' : [
[
'fullscreen', 'source', 'undo', 'redo', '|',
'fontsize',
'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat',
'formatmatch', 'blockquote', 'pasteplain', '|',
'forecolor', 'backcolor', '|',
'lineheight', '|',
'indent', '|', 'insertimage', '|',
'justifyleft', //居左对齐
'justifyright', //居右对齐
'justifycenter', //居中对齐
'justifyjustify', //两端对齐
],
]
});
/*
* 初始化分类
*/
$(function () {
});
</script>
\ No newline at end of file
{layout name="public/layout_main"}
<link rel="stylesheet" href="/static/fileinput/css/fileinput.css">
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> <a href="{:url('admin/project/catalogs')}">分类管理</a> <i class="fa fa-angle-right"></i> 添加分类</h3>
<!-- 分割线 -->
<hr>
<div class="col-xs-12" >
<form method="post" class="form-horizontal" enctype="multipart/form-data" action="{:url('admin/project/addCatalogs')}">
<div class="form-group">
<label for="title" class="col-sm-2 control-label text-right">分类名</label>
<div class="col-sm-10 col-md-8 col-lg-6">
<input type="text" class="form-control" name="name">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-2 control-label text-right" >分类图标</label>
<div class="col-sm-10 col-md-8 col-lg-6">
<input type="hidden" name='old_poster'>
<input id="input-b1" name="poster" type="file">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-2 control-label text-right">排序</label>
<div class="col-sm-10 col-md-8 col-lg-6">
<input type="number" class="form-control" name="sort">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button class="btn btn-success" id="btn-save">提交</button>
</div>
</div>
</form>
</div>
</section>
<!-- 文件上传和select插件 -->
<script type="text/javascript" src="/static/fileinput/js/fileinput.min.js"></script>
<script type="text/javascript" src="/static/fileinput/js/locales/zh.js"></script>
<script type="text/javascript">
// 文档加载完毕之后,会进入该方法
// 初始化文件上传
var fileInput = $("#input-b1").fileinput({
language: 'zh',
showUpload:false, //是否显示上传按钮
allowedFileExtensions: ['bmp','jpg','png','tif','gif','pcx','tga','exif','fpx','svg','cdr','pcd','dxf','ufo','eps','raw','WMF','webp'],//接收的文件后缀
})
$("#input-b1").change(function(data){
if(this.files.length>0){
$("#poster_view").hide();
}else{
$("#poster_view").show();
}
})
$("#input-b1").on("fileclear",function(event, data, msg){
$("#poster_view").show();
});
$(function(){
$(".btn-delete").click(function(){
var _this = $(this);
var url = "delete";
var oid = _this.attr('oid');
showDialog("提示", "确定删除这篇文章吗?", function () {
// ajax post 方法
$.post(url, {id:oid}, function (res) {
var res = JSON.parse(res);
if (res.error == 1) {
// javascript 的默认弹出提示方法
alert(res.msg);
} else {
_this.remove();
$("#tr_"+oid).fadeOut();
}
});
});
});
});
</script>
{layout name="public/layout_main"}
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> 预约管理</h3>
<!-- 分割线 -->
<hr>
<div class="row margin-bottom">
<div class="col-md-12">
<form class="form-inline pull-left" method="GET" action="{:url('admin/project/citys')}" >
<div class="form-group margin-right">
<input class="form-control" type="text" name="name" id="name" value="<?php echo input('title');?>" placeholder="用户名"/>
</div>
<button type="submit" class="btn btn-primary">搜索</button>
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>ID</th>
<th>活动信息</th>
<th>用户信息</th>
<th>姓名</th>
<th>手机号</th>
<th>期望日期</th>
<th>备注</th>
<th>预约时间</th>
</tr>
</thead>
<tbody>
{volist name="items" id="vo" key="k" empty="暂时没有数据"}
<tr id="tr_{$vo.id}">
<td>{$k}</td>
<td>
{if condition="$vo.project_poster"}
<a href="{$vo.project_poster}" target="_blank" data-fancybox="images">
<img src="{$vo.project_poster}" width='100'>
</a>
<p style="padding:0;margin:0;">{$vo.project_title}</p>
{/if}
</td>
<td>
<p style="padding:0;margin:0;text-align:center">{$vo.user_info.nickname}</p>
<p style="padding:0;margin:0;text-align:center">{$vo.user_info.phone}</p>
<p style="padding:0;margin:0;text-align:center;color:#f60">
{if condition="$vo.user_info.is_vip == 1"}
{/if}
</p>
</td>
<td>{$vo.nickname}</td>
<td>{$vo.phone}</td>
<td><?=explode(' ', $vo['expectation_time'])[0]?></td>
<td>{$vo.remark}</td>
<td>{$vo.created_at}</td>
</tr>
{/volist}
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{$items->render()}
</div>
</div>
</section>
<script type="text/javascript">
// 文档加载完毕之后,会进入该方法
$(function(){
$(".btn-delete").click(function(){
var _this = $(this);
var url = "{:url('admin/project/deleteCity')}";
var oid = _this.attr('oid');
showDialog("提示", "确定删除该城市吗?", function(){
// ajax post 方法
$.post(url, {id:oid}, function (res) {
// var res = JSON.parse(res);
if(res.code == 1){
// javascript 的默认弹出提示方法
_this.remove();
$("#tr_"+oid).fadeOut();
}else{
alert(res.msg);
}
});
});
});
});
</script>
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment