21 changed files with 2688 additions and 16 deletions
@ -0,0 +1,116 @@ |
|||||
|
<?php |
||||
|
|
||||
|
|
||||
|
namespace app\admin\controller\vote; |
||||
|
|
||||
|
|
||||
|
use app\admin\logic\content\HelpCategoryLogic; |
||||
|
use app\admin\logic\content\HelpLogic; |
||||
|
use app\admin\logic\content\ResourceCategoryLogic; |
||||
|
use app\admin\logic\content\ResourceLogic; |
||||
|
use app\admin\logic\vote\VoteLogic; |
||||
|
use app\admin\validate\content\HelpValidate; |
||||
|
use app\common\basics\AdminBase; |
||||
|
use app\common\server\JsonServer; |
||||
|
|
||||
|
class Vote extends AdminBase |
||||
|
{ |
||||
|
/** |
||||
|
* @NOTES: 帮助分类列表 |
||||
|
* @author: 张无忌 |
||||
|
*/ |
||||
|
public function lists() |
||||
|
{ |
||||
|
if ($this->request->isAjax()) { |
||||
|
$get = $this->request->get(); |
||||
|
$lists = VoteLogic::lists($get); |
||||
|
return JsonServer::success("获取成功", $lists); |
||||
|
} |
||||
|
|
||||
|
return view(''); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @NOTES: 添加帮助类 |
||||
|
* @author: 张无忌 |
||||
|
*/ |
||||
|
public function add() |
||||
|
{ |
||||
|
if ($this->request->isAjax()) { |
||||
|
$post = $this->request->post(); |
||||
|
$res = VoteLogic::add($post); |
||||
|
if ($res === false) { |
||||
|
$error = VoteLogic::getError() ?: '新增失败'; |
||||
|
return JsonServer::error($error); |
||||
|
} |
||||
|
return JsonServer::success('新增成功'); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
return view(''); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @NOTES: 编辑帮助分类 |
||||
|
* @author: 张无忌 |
||||
|
*/ |
||||
|
public function edit() |
||||
|
{ |
||||
|
if ($this->request->isAjax()) { |
||||
|
$post = $this->request->post(); |
||||
|
$res = VoteLogic::edit($post); |
||||
|
if ($res === false) { |
||||
|
$error = VoteLogic::getError() ?: '编辑失败'; |
||||
|
return JsonServer::error($error); |
||||
|
} |
||||
|
return JsonServer::success('编辑成功'); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
$id = $this->request->get('id'); |
||||
|
$detail = VoteLogic::detail($id); |
||||
|
|
||||
|
return view('', [ |
||||
|
'detail' => $detail, |
||||
|
]); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @NOTES: 删除帮助分类 |
||||
|
* @author: 张无忌 |
||||
|
*/ |
||||
|
public function del() |
||||
|
{ |
||||
|
if ($this->request->isAjax()) { |
||||
|
$id = $this->request->post('id'); |
||||
|
$res = VoteLogic::del($id); |
||||
|
if ($res === false) { |
||||
|
$error = VoteLogic::getError() ?: '删除失败'; |
||||
|
return JsonServer::error($error); |
||||
|
} |
||||
|
return JsonServer::success('删除成功'); |
||||
|
} |
||||
|
|
||||
|
return JsonServer::error('异常'); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Notes: 隐藏帮助分类 |
||||
|
* @Author: 张无忌 |
||||
|
*/ |
||||
|
public function status() |
||||
|
{ |
||||
|
if ($this->request->isAjax()) { |
||||
|
$id = $this->request->post('id'); |
||||
|
$status = $this->request->post('status'); |
||||
|
$res = VoteLogic::status($id,$status); |
||||
|
if ($res === false) { |
||||
|
$error = VoteLogic::getError() ?: '操作失败'; |
||||
|
return JsonServer::error($error); |
||||
|
} |
||||
|
return JsonServer::success('操作成功'); |
||||
|
} |
||||
|
|
||||
|
return JsonServer::success('异常'); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,122 @@ |
|||||
|
<?php |
||||
|
|
||||
|
|
||||
|
namespace app\admin\controller\vote; |
||||
|
|
||||
|
|
||||
|
use app\admin\logic\content\HelpCategoryLogic; |
||||
|
use app\admin\logic\content\HelpLogic; |
||||
|
use app\admin\logic\content\ResourceCategoryLogic; |
||||
|
use app\admin\logic\content\ResourceLogic; |
||||
|
use app\admin\logic\vote\VoteLogic; |
||||
|
use app\admin\logic\vote\VotePlayerLogic; |
||||
|
use app\admin\validate\content\HelpValidate; |
||||
|
use app\common\basics\AdminBase; |
||||
|
use app\common\server\JsonServer; |
||||
|
|
||||
|
class VotePlayer extends AdminBase |
||||
|
{ |
||||
|
/** |
||||
|
* @NOTES: 帮助分类列表 |
||||
|
* @author: 张无忌 |
||||
|
*/ |
||||
|
public function lists() |
||||
|
{ |
||||
|
if ($this->request->isAjax()) { |
||||
|
$get = $this->request->get(); |
||||
|
$lists = VotePlayerLogic::lists($get); |
||||
|
return JsonServer::success("获取成功", $lists); |
||||
|
} |
||||
|
|
||||
|
return view('', [ |
||||
|
'votes' => VoteLogic::getVotes() |
||||
|
]); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @NOTES: 添加帮助类 |
||||
|
* @author: 张无忌 |
||||
|
*/ |
||||
|
public function add() |
||||
|
{ |
||||
|
if ($this->request->isAjax()) { |
||||
|
$post = $this->request->post(); |
||||
|
$res = VotePlayerLogic::add($post); |
||||
|
if ($res === false) { |
||||
|
$error = VotePlayerLogic::getError() ?: '新增失败'; |
||||
|
return JsonServer::error($error); |
||||
|
} |
||||
|
return JsonServer::success('新增成功'); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
return view('', [ |
||||
|
'votes' => VoteLogic::getVotes() |
||||
|
]); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @NOTES: 编辑帮助分类 |
||||
|
* @author: 张无忌 |
||||
|
*/ |
||||
|
public function edit() |
||||
|
{ |
||||
|
if ($this->request->isAjax()) { |
||||
|
$post = $this->request->post(); |
||||
|
$res = VotePlayerLogic::edit($post); |
||||
|
if ($res === false) { |
||||
|
$error = VotePlayerLogic::getError() ?: '编辑失败'; |
||||
|
return JsonServer::error($error); |
||||
|
} |
||||
|
return JsonServer::success('编辑成功'); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
$id = $this->request->get('id'); |
||||
|
$detail = VotePlayerLogic::detail($id); |
||||
|
|
||||
|
return view('', [ |
||||
|
'detail' => $detail, |
||||
|
'votes' => VoteLogic::getVotes() |
||||
|
]); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @NOTES: 删除帮助分类 |
||||
|
* @author: 张无忌 |
||||
|
*/ |
||||
|
public function del() |
||||
|
{ |
||||
|
if ($this->request->isAjax()) { |
||||
|
$id = $this->request->post('id'); |
||||
|
$res = VotePlayerLogic::del($id); |
||||
|
if ($res === false) { |
||||
|
$error = VotePlayerLogic::getError() ?: '删除失败'; |
||||
|
return JsonServer::error($error); |
||||
|
} |
||||
|
return JsonServer::success('删除成功'); |
||||
|
} |
||||
|
|
||||
|
return JsonServer::error('异常'); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Notes: 隐藏帮助分类 |
||||
|
* @Author: 张无忌 |
||||
|
*/ |
||||
|
public function status() |
||||
|
{ |
||||
|
if ($this->request->isAjax()) { |
||||
|
$id = $this->request->post('id'); |
||||
|
$status = $this->request->post('status'); |
||||
|
$res = VotePlayerLogic::status($id,$status); |
||||
|
if ($res === false) { |
||||
|
$error = VotePlayerLogic::getError() ?: '操作失败'; |
||||
|
return JsonServer::error($error); |
||||
|
} |
||||
|
return JsonServer::success('操作成功'); |
||||
|
} |
||||
|
|
||||
|
return JsonServer::success('异常'); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,215 @@ |
|||||
|
<?php |
||||
|
|
||||
|
|
||||
|
namespace app\admin\logic\vote; |
||||
|
|
||||
|
|
||||
|
use app\common\basics\Logic; |
||||
|
use app\common\model\content\ResourceCategory; |
||||
|
use app\common\model\vote\Vote; |
||||
|
use Exception; |
||||
|
|
||||
|
class VoteLogic extends Logic |
||||
|
{ |
||||
|
/** |
||||
|
* 获取分类 |
||||
|
* @param $get |
||||
|
* @return array |
||||
|
*/ |
||||
|
public static function lists($get) |
||||
|
{ |
||||
|
try { |
||||
|
$where = [ |
||||
|
['del', '=', 0] |
||||
|
]; |
||||
|
|
||||
|
if (!empty($get['title']) and trim($get['title'])!='') |
||||
|
$where[] = ['title', 'like', '%'.$get['title'].'%']; |
||||
|
|
||||
|
|
||||
|
$model = new Vote(); |
||||
|
$lists = $model->field(true) |
||||
|
->where($where) |
||||
|
->order('add_time', 'desc') |
||||
|
->paginate([ |
||||
|
'page' => $get['page'], |
||||
|
'list_rows' => $get['limit'], |
||||
|
'var_page' => 'page' |
||||
|
]) |
||||
|
->toArray(); |
||||
|
|
||||
|
|
||||
|
|
||||
|
foreach ($lists['data'] as &$item) { |
||||
|
$item['start_time'] = $item['start_time']? date("Y-m-d H:i:s",$item['start_time']):""; |
||||
|
$item['end_time'] = $item['end_time']? date("Y-m-d H:i:s",$item['end_time']):""; |
||||
|
$item['add_time'] = $item['add_time']? date("Y-m-d H:i:s",$item['add_time']):""; |
||||
|
$item['is_rank'] = $item['is_rank'] ? '显示' : '隐藏'; |
||||
|
$item['is_redo'] = $item['is_redo']==0 ? '当天不可重复' : ($item['is_redo']==1?"全部不重复":"可重复"); |
||||
|
$item['vote_str'] = ($item['vote_type']==0 ? '每天' : '总共').$item['vote_num']."票"; |
||||
|
$item['status'] = $item['status'] ? '显示' : '隐藏'; |
||||
|
|
||||
|
} |
||||
|
return ['count'=>$lists['total'], 'lists'=>$lists['data']]; |
||||
|
} catch (Exception $e) { |
||||
|
return ['error'=>$e->getMessage()]; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Notes: 资料详细 |
||||
|
* @Author: |
||||
|
* @param $id |
||||
|
* @return array |
||||
|
*/ |
||||
|
public static function detail($id) |
||||
|
{ |
||||
|
$model = new Vote(); |
||||
|
$detail = $model->field(true)->findOrEmpty($id)->toArray(); |
||||
|
$detail['start_time'] = $detail['start_time']? date("Y-m-d H:i:s",$detail['start_time']):""; |
||||
|
$detail['end_time'] = $detail['end_time']? date("Y-m-d H:i:s",$detail['end_time']):""; |
||||
|
$detail['images_arr'] = $detail['images']? explode(",",$detail['images']):[]; |
||||
|
return $detail; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Notes: 添加帮助 |
||||
|
* @Author: |
||||
|
* @param $post |
||||
|
* @return bool |
||||
|
*/ |
||||
|
public static function add($post) |
||||
|
{ |
||||
|
try { |
||||
|
if(isset($post['goods_image']) && count($post['goods_image']) ){ |
||||
|
$post['images'] = implode(",",$post['goods_image']); |
||||
|
} |
||||
|
Vote::create([ |
||||
|
'title' => $post['title'], |
||||
|
'image' => $post['image'] ?? '', |
||||
|
'video' => $post['video'] ?? '', |
||||
|
'images' => $post['images'] ?? '', |
||||
|
'notice' => $post['notice'] ?? '', |
||||
|
'content' => $post['content'] ?? '', |
||||
|
'start_time' => $post['start_time'] ? strtotime($post['start_time']) : 0, |
||||
|
'end_time' => $post['end_time'] ? strtotime($post['end_time']) : 0, |
||||
|
'is_rank' => $post['is_rank'] ?? 1, |
||||
|
'is_redo' => $post['is_redo'] ?? 0, |
||||
|
'province_id' => $post['province_id'] ?? 0, |
||||
|
'vote_type' => $post['vote_type'] ?? 0, |
||||
|
'vote_num' => $post['vote_num'] ?? 0, |
||||
|
'base_visit' => $post['base_visit'] ?? 0, |
||||
|
'status' => $post['status'] ?? 1, |
||||
|
'vote_total' => 0, |
||||
|
'views' => 0, |
||||
|
'add_time' => time(), |
||||
|
]); |
||||
|
|
||||
|
return true; |
||||
|
} catch (\Exception $e) { |
||||
|
static::$error = $e->getMessage(); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Notes: 编辑帮助 |
||||
|
* @Author: 张无忌 |
||||
|
* @param $post |
||||
|
* @return bool |
||||
|
*/ |
||||
|
public static function edit($post) |
||||
|
{ |
||||
|
try { |
||||
|
if(isset($post['goods_image']) && count($post['goods_image'])){ |
||||
|
$post['images'] = implode(",",$post['goods_image']); |
||||
|
} |
||||
|
Vote::update([ |
||||
|
'title' => $post['title'], |
||||
|
'image' => $post['image'] ?? '', |
||||
|
'video' => $post['video'] ?? '', |
||||
|
'images' => $post['images'] ?? '', |
||||
|
'notice' => $post['notice'] ?? '', |
||||
|
'content' => $post['content'] ?? '', |
||||
|
'start_time' => $post['start_time'] ? strtotime($post['start_time']) : 0, |
||||
|
'end_time' => $post['end_time'] ? strtotime($post['end_time']) : 0, |
||||
|
'is_rank' => $post['is_rank'] ?? 1, |
||||
|
'is_redo' => $post['is_redo'] ?? 0, |
||||
|
'province_id' => $post['province_id'] ?? 0, |
||||
|
'vote_type' => $post['vote_type'] ?? 0, |
||||
|
'vote_num' => $post['vote_num'] ?? 0, |
||||
|
'base_visit' => $post['base_visit'] ?? 0, |
||||
|
'status' => $post['status'] ?? 1, |
||||
|
'update_time' => time(), |
||||
|
], ['id'=>$post['id']]); |
||||
|
return true; |
||||
|
} catch (\Exception $e) { |
||||
|
static::$error = $e->getMessage(); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Notes: 删除 |
||||
|
* @Author: |
||||
|
* @param $id |
||||
|
* @return bool |
||||
|
*/ |
||||
|
public static function del($id) |
||||
|
{ |
||||
|
try { |
||||
|
Vote::update([ |
||||
|
'del' => 1, |
||||
|
'update_time' => time() |
||||
|
], ['id'=>$id]); |
||||
|
|
||||
|
return true; |
||||
|
} catch (\Exception $e) { |
||||
|
static::$error = $e->getMessage(); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Notes: 隐藏 |
||||
|
* @Author: 张无忌 |
||||
|
* @param $id |
||||
|
* @return bool |
||||
|
*/ |
||||
|
public static function status($id,$status) |
||||
|
{ |
||||
|
try { |
||||
|
Vote::update([ |
||||
|
'status' => $status, |
||||
|
'update_time' => time() |
||||
|
], ['id'=>$id]); |
||||
|
|
||||
|
return true; |
||||
|
} catch (\Exception $e) { |
||||
|
static::$error = $e->getMessage(); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @Notes: 获取分类 |
||||
|
* @Author: 张无忌 |
||||
|
* @return array |
||||
|
*/ |
||||
|
public static function getVotes() |
||||
|
{ |
||||
|
try { |
||||
|
$model = new Vote(); |
||||
|
return $model->field(true) |
||||
|
->where(['del'=>0, 'status'=>1]) |
||||
|
->order('id', 'desc') |
||||
|
->select() |
||||
|
->toArray(); |
||||
|
|
||||
|
} catch (\Exception $e) { |
||||
|
return []; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,176 @@ |
|||||
|
<?php |
||||
|
|
||||
|
|
||||
|
namespace app\admin\logic\vote; |
||||
|
|
||||
|
|
||||
|
use app\common\basics\Logic; |
||||
|
use app\common\model\vote\Vote; |
||||
|
use app\common\model\vote\VotePlayer; |
||||
|
use Exception; |
||||
|
|
||||
|
class VotePlayerLogic extends Logic |
||||
|
{ |
||||
|
/** |
||||
|
* 获取分类 |
||||
|
* @param $get |
||||
|
* @return array |
||||
|
*/ |
||||
|
public static function lists($get) |
||||
|
{ |
||||
|
try { |
||||
|
$where = [ |
||||
|
['del', '=', 0] |
||||
|
]; |
||||
|
|
||||
|
if (!empty($get['title']) and trim($get['title'])!='') |
||||
|
$where[] = ['title', 'like', '%'.$get['title'].'%']; |
||||
|
|
||||
|
if (!empty($get['vid']) and is_numeric($get['vid'])) |
||||
|
$where[] = ['vote_id', '=', $get['vid']]; |
||||
|
|
||||
|
|
||||
|
$model = new VotePlayer(); |
||||
|
$lists = $model->field(true) |
||||
|
->where($where) |
||||
|
->with(['vote']) |
||||
|
->order('id', 'desc') |
||||
|
->paginate([ |
||||
|
'page' => $get['page'], |
||||
|
'list_rows' => $get['limit'], |
||||
|
'var_page' => 'page' |
||||
|
]) |
||||
|
->toArray(); |
||||
|
|
||||
|
foreach ($lists['data'] as &$item) { |
||||
|
$item['vote_title'] = $item['vote']['title'] ?? ''; |
||||
|
$item['add_time'] = $item['add_time']? date("Y-m-d H:i:s",$item['add_time']):""; |
||||
|
$item['status'] = $item['status'] ? '显示' : '隐藏'; |
||||
|
} |
||||
|
return ['count'=>$lists['total'], 'lists'=>$lists['data']]; |
||||
|
} catch (Exception $e) { |
||||
|
return ['error'=>$e->getMessage()]; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Notes: 资料详细 |
||||
|
* @Author: |
||||
|
* @param $id |
||||
|
* @return array |
||||
|
*/ |
||||
|
public static function detail($id) |
||||
|
{ |
||||
|
$model = new VotePlayer(); |
||||
|
$detail = $model->field(true)->findOrEmpty($id)->toArray(); |
||||
|
$detail['images_arr'] = $detail['images']? explode(",",$detail['images']):[]; |
||||
|
return $detail; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Notes: 添加帮助 |
||||
|
* @Author: |
||||
|
* @param $post |
||||
|
* @return bool |
||||
|
*/ |
||||
|
public static function add($post) |
||||
|
{ |
||||
|
try { |
||||
|
if(isset($post['goods_image']) && count($post['goods_image'])){ |
||||
|
$post['images'] = implode(",",$post['goods_image']); |
||||
|
} |
||||
|
VotePlayer::create([ |
||||
|
'vote_id' => $post['vote_id']??0, |
||||
|
'name' => $post['name'], |
||||
|
'avatar' => $post['avatar'] ?? '', |
||||
|
'video' => $post['video'] ?? '', |
||||
|
'images' => $post['images'] ?? '', |
||||
|
'intro' => $post['intro'] ?? '', |
||||
|
'vote_num' => $post['vote_num'] ?? 0, |
||||
|
'base_visit' => $post['base_visit'] ?? 0, |
||||
|
'status' => $post['status'] ?? 1, |
||||
|
'vote_total' => 0, |
||||
|
'views' => 0, |
||||
|
'add_time' => time(), |
||||
|
]); |
||||
|
|
||||
|
return true; |
||||
|
} catch (\Exception $e) { |
||||
|
static::$error = $e->getMessage(); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Notes: 编辑帮助 |
||||
|
* @Author: 张无忌 |
||||
|
* @param $post |
||||
|
* @return bool |
||||
|
*/ |
||||
|
public static function edit($post) |
||||
|
{ |
||||
|
try { |
||||
|
if(isset($post['goods_image']) && count($post['goods_image'])){ |
||||
|
$post['images'] = implode(",",$post['goods_image']); |
||||
|
} |
||||
|
VotePlayer::update([ |
||||
|
'vote_id' => $post['vote_id']??0, |
||||
|
'name' => $post['name'], |
||||
|
'avatar' => $post['avatar'] ?? '', |
||||
|
'video' => $post['video'] ?? '', |
||||
|
'images' => $post['images'] ?? '', |
||||
|
'intro' => $post['intro'] ?? '', |
||||
|
'vote_num' => $post['vote_num'] ?? 0, |
||||
|
'base_visit' => $post['base_visit'] ?? 0, |
||||
|
'status' => $post['status'] ?? 1, |
||||
|
'update_time' => time(), |
||||
|
], ['id'=>$post['id']]); |
||||
|
return true; |
||||
|
} catch (\Exception $e) { |
||||
|
static::$error = $e->getMessage(); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Notes: 删除 |
||||
|
* @Author: |
||||
|
* @param $id |
||||
|
* @return bool |
||||
|
*/ |
||||
|
public static function del($id) |
||||
|
{ |
||||
|
try { |
||||
|
VotePlayer::update([ |
||||
|
'del' => 1, |
||||
|
'update_time' => time() |
||||
|
], ['id'=>$id]); |
||||
|
|
||||
|
return true; |
||||
|
} catch (\Exception $e) { |
||||
|
static::$error = $e->getMessage(); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Notes: 隐藏 |
||||
|
* @Author: 张无忌 |
||||
|
* @param $id |
||||
|
* @return bool |
||||
|
*/ |
||||
|
public static function status($id,$status) |
||||
|
{ |
||||
|
try { |
||||
|
VotePlayer::update([ |
||||
|
'status' => $status, |
||||
|
'update_time' => time() |
||||
|
], ['id'=>$id]); |
||||
|
|
||||
|
return true; |
||||
|
} catch (\Exception $e) { |
||||
|
static::$error = $e->getMessage(); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,304 @@ |
|||||
|
{layout name="layout2" /} |
||||
|
<style> |
||||
|
.layui-form-label{width: 100px} |
||||
|
.layui-form-item .layui-input-inline { width: 340px; } |
||||
|
.pay-li { |
||||
|
float: left; |
||||
|
opacity: 1; |
||||
|
position: relative; |
||||
|
} |
||||
|
.pay-img { |
||||
|
width: 80px; |
||||
|
height: 80px; |
||||
|
padding: 4px; |
||||
|
} |
||||
|
.pay-img-del-x { |
||||
|
position: absolute; |
||||
|
z-index: 100; |
||||
|
top: -4px; |
||||
|
right: -2px; |
||||
|
width: 20px; |
||||
|
height: 20px; |
||||
|
font-size: 16px; |
||||
|
line-height: 16px; |
||||
|
color: #fff; |
||||
|
text-align: center; |
||||
|
cursor: pointer; |
||||
|
background: hsla(0, 0%, 60%, .6); |
||||
|
border-radius: 10px; |
||||
|
} |
||||
|
.upload-cert-a{ |
||||
|
cursor: pointer; |
||||
|
position: absolute; |
||||
|
z-index: 100; |
||||
|
top: 58px; |
||||
|
right: -10%; |
||||
|
width: 100px; |
||||
|
height: 20px; |
||||
|
font-size: 8px; |
||||
|
line-height: 16px; |
||||
|
text-align: center; |
||||
|
border-radius: 10px; |
||||
|
color: #4e8bff; |
||||
|
} |
||||
|
.upload-cert-a:hover { |
||||
|
color: #0641cb; |
||||
|
} |
||||
|
.pay-cert{ |
||||
|
height:80px;line-height:80px |
||||
|
} |
||||
|
.cert-add,.key-add{ |
||||
|
height: 80px; |
||||
|
width: 80px; |
||||
|
float: left; |
||||
|
opacity: 1; |
||||
|
position: relative; |
||||
|
border:1px dashed #a0a0a0; |
||||
|
background-image:url('/static/common/image/default/add_file.png'); |
||||
|
background-repeat: no-repeat; |
||||
|
background-position: 50% 35%; |
||||
|
background-size:40px 40px; |
||||
|
margin: 4px; |
||||
|
text-align: center; |
||||
|
} |
||||
|
</style> |
||||
|
|
||||
|
<div class="layui-card layui-form" style="box-shadow:none;"> |
||||
|
<div class="layui-card-body"> |
||||
|
<div class="layui-form-item"> |
||||
|
<label for="title" class="layui-form-label"><span style="color:red;">*</span>标题:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" name="title" id="title" lay-verType="tips" lay-verify="required" autocomplete="off" class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label for="notice" class="layui-form-label">简介:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" name="notice" id="notice" autocomplete="off" class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<!-- 开播时间 --> |
||||
|
<div class="layui-form-item"> |
||||
|
<label for="startTime" class="layui-form-label" ><font color="red">*</font>开始时间:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" id="startTime" name="start_time" placeholder="填写开始时间" value="" |
||||
|
class="layui-input" autocomplete="off" lay-verType="tips" lay-verify="required" readonly> |
||||
|
</div> |
||||
|
</div> |
||||
|
<!-- 结束时间 --> |
||||
|
<div class="layui-form-item"> |
||||
|
<label for="endTime" class="layui-form-label" ><font color="red">*</font>结束时间:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" id="endTime" name="end_time" class="layui-input" placeholder="结束时间" value="" |
||||
|
autocomplete="off" lay-verType="tips" lay-verify="required" readonly> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">封面图:</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<div class="like-upload-image" switch-tab="0" lay-verType="tips"> |
||||
|
<div class="upload-image-elem"><a class="add-upload-image" id="image"> + 添加图片</a></div> |
||||
|
</div> |
||||
|
<div class="layui-form-mid layui-word-aux">建议尺寸:500*500像</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item" style="margin-bottom: 0px"> |
||||
|
<label class="layui-form-label"><span class="form-label-asterisk">*</span>活动轮播图:</label> |
||||
|
<div class="layui-input-block" id="goodsImageContainer"> |
||||
|
<div class="like-upload-image"> |
||||
|
<div class="upload-image-elem"><a class="add-upload-image" id="images"> + 添加图片</a></div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label"></label> |
||||
|
<span style="color: #a3a3a3;font-size: 9px">建议尺寸:800*800像素,最多上传5张</span> |
||||
|
</div> |
||||
|
|
||||
|
<!--商品视频--> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">活动视频:</label> |
||||
|
<div class="layui-input-block" id="videoContainer"> |
||||
|
<div class="like-upload-video"> |
||||
|
<div class="upload-image-elem"><a class="add-upload-video" id="video"> + 添加视频</a></div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label"></label> |
||||
|
<span style="color: #a3a3a3;font-size: 9px">活动视频,在投票详情页面播放。(限制30m内)</span> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">显示排行榜:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="radio" name="is_rank" value="1" title="显示" checked> |
||||
|
<input type="radio" name="is_rank" value="0" title="隐藏" > |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">允许重复投票:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="radio" name="is_redo" value="0" title="当天不重复" checked> |
||||
|
<input type="radio" name="is_redo" value="1" title="全部不重复"> |
||||
|
<input type="radio" name="is_redo" value="2" title="可重复" > |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">投票方式:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="radio" name="vote_type" value="0" title="每天" checked> |
||||
|
<input type="radio" name="vote_type" value="1" title="总共" > |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label"></label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="number" id="vote_num" name="vote_num" class="layui-input" placeholder="次数" /> |
||||
|
</div> |
||||
|
<label class="layui-form-label">次</label> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label for="title" class="layui-form-label">基础浏览数:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="number" name="base_visit" id="base_visit" lay-verType="tips" lay-verify="required" autocomplete="off" class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">状态:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="radio" name="status" value="1" title="显示"> |
||||
|
<input type="radio" name="status" value="0" title="隐藏" checked> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label for="content" class="layui-form-label">资料内容:</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<textarea name="content" id="content" lay-verify="content" class="layui-textarea" rows="4"></textarea> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="layui-form-item layui-hide"> |
||||
|
<input type="button" lay-submit lay-filter="addSubmit" id="addSubmit" value="确认"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<script src="__PUBLIC__/static/common/js/area.js"></script> |
||||
|
<script> |
||||
|
layui.config({ |
||||
|
base: "/static/lib/" |
||||
|
|
||||
|
}).extend({ |
||||
|
likeedit: "likeedit/likeedit", |
||||
|
likeArea: "likeArea/likeArea", |
||||
|
}).use(["likeedit","likeArea", "form",'laydate'], function(){ |
||||
|
var form = layui.form; |
||||
|
var likeedit = layui.likeedit; |
||||
|
var likeArea = layui.likeArea; |
||||
|
var laydate = layui.laydate |
||||
|
var content = likeedit.build("content", { |
||||
|
uploadImage: { |
||||
|
url: '{:url("file/lists")}?type=10' |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
// 时间组件 |
||||
|
laydate.render({type:'datetime' ,elem:'#startTime', trigger:'click'}); |
||||
|
laydate.render({type:'datetime' ,elem:'#endTime' ,trigger: 'click'}); |
||||
|
|
||||
|
|
||||
|
form.verify({ |
||||
|
content: function() { |
||||
|
likeedit.sync(content) |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
like.delUpload(); |
||||
|
// $(document).on("click", ".add-upload-image", function () { |
||||
|
// like.imageUpload({ |
||||
|
// limit: 1, |
||||
|
// field: "image", |
||||
|
// that: $(this) |
||||
|
// }); |
||||
|
// }); |
||||
|
|
||||
|
// 商品封面图 |
||||
|
$(document).on("click", "#image", function () { |
||||
|
like.imageUpload({ |
||||
|
limit: 1, |
||||
|
field: "image", |
||||
|
that: $(this), |
||||
|
content: '{:url("file/lists")}?type=10' |
||||
|
}); |
||||
|
}) |
||||
|
// 商品轮播图 |
||||
|
$(document).on("click", "#images", function () { |
||||
|
like.imageUpload({ |
||||
|
limit: 5, |
||||
|
field: "goods_image[]", |
||||
|
that: $(this), |
||||
|
content: '{:url("file/lists")}?type=10' |
||||
|
}); |
||||
|
}) |
||||
|
// 商品视频 |
||||
|
$(document).on("click", "#video", function () { |
||||
|
like.videoUpload({ |
||||
|
limit: 1, |
||||
|
field: "video", |
||||
|
that: $(this), |
||||
|
content: '{:url("file/lists")}?type=20' |
||||
|
}); |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
//删除图片/证书 |
||||
|
$(document).on('click', '.pay-img-del-x', function () { |
||||
|
$(this).parent().siblings('input').val(''); |
||||
|
$(this).parent().siblings().css('display','block'); |
||||
|
$(this).parent().remove(); |
||||
|
}); |
||||
|
|
||||
|
//==========================================上传证书start========================================================= |
||||
|
|
||||
|
like.certUpload('.cert-add', '{:url("file/other")}?local=1&sub_dir=resource', '{$storageUrl}'); |
||||
|
//==========================================上传证书end=========================================================== |
||||
|
// 删除按钮的显示与隐藏 |
||||
|
$(document).on('mouseover', '.pay-img', function () { |
||||
|
$(this).next().show(); |
||||
|
}); |
||||
|
$(document).on('mouseout', '.pay-img', function () { |
||||
|
$(this).next().hide(); |
||||
|
}); |
||||
|
$(document).on('mouseover', '.pay-img-del-x', function () { |
||||
|
$(this).show(); |
||||
|
}); |
||||
|
$(document).on('mouseout', '.pay-img-del-x', function () { |
||||
|
$(this).hide(); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
likeArea.init( |
||||
|
"province", "city", "district", "province_id", "city_id", "district_id", |
||||
|
"", "", "" |
||||
|
); |
||||
|
likeArea.init( |
||||
|
"refund_province", "refund_city", "refund_district", "refund_province_id", "refund_city_id", "refund_district_id", |
||||
|
"", "", "" |
||||
|
); |
||||
|
|
||||
|
}) |
||||
|
</script> |
||||
@ -0,0 +1,327 @@ |
|||||
|
{layout name="layout2" /} |
||||
|
<style> |
||||
|
.layui-form-label{width: 100px} |
||||
|
.layui-form-item .layui-input-inline { width: 340px; } |
||||
|
.pay-li { |
||||
|
float: left; |
||||
|
opacity: 1; |
||||
|
position: relative; |
||||
|
} |
||||
|
.pay-img { |
||||
|
width: 80px; |
||||
|
height: 80px; |
||||
|
padding: 4px; |
||||
|
} |
||||
|
.pay-img-del-x { |
||||
|
position: absolute; |
||||
|
z-index: 100; |
||||
|
top: -4px; |
||||
|
right: -2px; |
||||
|
width: 20px; |
||||
|
height: 20px; |
||||
|
font-size: 16px; |
||||
|
line-height: 16px; |
||||
|
color: #fff; |
||||
|
text-align: center; |
||||
|
cursor: pointer; |
||||
|
background: hsla(0, 0%, 60%, .6); |
||||
|
border-radius: 10px; |
||||
|
} |
||||
|
.upload-cert-a{ |
||||
|
cursor: pointer; |
||||
|
position: absolute; |
||||
|
z-index: 100; |
||||
|
top: 58px; |
||||
|
right: -10%; |
||||
|
width: 100px; |
||||
|
height: 20px; |
||||
|
font-size: 8px; |
||||
|
line-height: 16px; |
||||
|
text-align: center; |
||||
|
border-radius: 10px; |
||||
|
color: #4e8bff; |
||||
|
} |
||||
|
.upload-cert-a:hover { |
||||
|
color: #0641cb; |
||||
|
} |
||||
|
.pay-cert{ |
||||
|
height:80px;line-height:80px |
||||
|
} |
||||
|
.cert-add,.key-add{ |
||||
|
height: 80px; |
||||
|
width: 80px; |
||||
|
float: left; |
||||
|
opacity: 1; |
||||
|
position: relative; |
||||
|
border:1px dashed #a0a0a0; |
||||
|
background-image:url('/static/common/image/default/add_file.png'); |
||||
|
background-repeat: no-repeat; |
||||
|
background-position: 50% 35%; |
||||
|
background-size:40px 40px; |
||||
|
margin: 4px; |
||||
|
text-align: center; |
||||
|
} |
||||
|
</style> |
||||
|
|
||||
|
<div class="layui-card layui-form" style="box-shadow:none;"> |
||||
|
<div class="layui-card-body"> |
||||
|
<div class="layui-form-item"> |
||||
|
<label for="title" class="layui-form-label"><span style="color:red;">*</span>标题:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" name="title" id="title" lay-verType="tips" lay-verify="required" value="{$detail['title']}" autocomplete="off" class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label for="notice" class="layui-form-label">简介:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" name="notice" id="notice" autocomplete="off" class="layui-input" value="{$detail['notice']}"> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<!-- 开播时间 --> |
||||
|
<div class="layui-form-item"> |
||||
|
<label for="startTime" class="layui-form-label" ><font color="red">*</font>开始时间:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" id="startTime" name="start_time" placeholder="填写开始时间" value="{$detail['start_time']}" |
||||
|
class="layui-input" autocomplete="off" lay-verType="tips" lay-verify="required" readonly> |
||||
|
</div> |
||||
|
</div> |
||||
|
<!-- 结束时间 --> |
||||
|
<div class="layui-form-item"> |
||||
|
<label for="endTime" class="layui-form-label" ><font color="red">*</font>结束时间:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" id="endTime" name="end_time" class="layui-input" placeholder="结束时间" value="{$detail['end_time']}" |
||||
|
autocomplete="off" lay-verType="tips" lay-verify="required" readonly> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">封面图:</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<div class="like-upload-image" switch-tab="0" lay-verType="tips"> |
||||
|
{if $detail.image} |
||||
|
<div class="upload-image-div"> |
||||
|
<img src="{$detail.image}" alt="img"> |
||||
|
<input type="hidden" name="image" value="{$detail.image}"> |
||||
|
<div class="del-upload-btn">x</div> |
||||
|
</div> |
||||
|
{/if} |
||||
|
<div class="upload-image-elem"><a class="add-upload-image" id="image"> + 添加图片</a></div> |
||||
|
</div> |
||||
|
<div class="layui-form-mid layui-word-aux">建议尺寸:500*500像</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item" style="margin-bottom: 0px"> |
||||
|
<label class="layui-form-label"><span class="form-label-asterisk">*</span>活动轮播图:</label> |
||||
|
<div class="layui-input-block" id="goodsImageContainer"> |
||||
|
{foreach $detail['images_arr'] as $val} |
||||
|
<div class="upload-image-div"> |
||||
|
<img src="{$val}" alt="img" /> |
||||
|
<input type="hidden" name="goods_image[]" value="{$val}"> |
||||
|
<div class="del-upload-btn">x</div> |
||||
|
</div> |
||||
|
{/foreach} |
||||
|
<div class="like-upload-image"> |
||||
|
<div class="upload-image-elem"><a class="add-upload-image" id="images"> + 添加图片</a></div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label"></label> |
||||
|
<span style="color: #a3a3a3;font-size: 9px">建议尺寸:800*800像素,最多上传5张</span> |
||||
|
</div> |
||||
|
|
||||
|
<!--商品视频--> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">活动视频:</label> |
||||
|
<div class="layui-input-block" id="videoContainer"> |
||||
|
<div class="like-upload-video"> |
||||
|
{if $detail.video} |
||||
|
<div class="upload-video-div"> |
||||
|
<video src="{$detail.video}"></video> |
||||
|
<input type="hidden" name="video" value="{$detail.video}"> |
||||
|
<div class="del-upload-btn">x</div> |
||||
|
</div> |
||||
|
{/if} |
||||
|
<div class="upload-image-elem"><a class="add-upload-video" id="video"> + 添加视频</a></div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label"></label> |
||||
|
<span style="color: #a3a3a3;font-size: 9px">活动视频,在投票详情页面播放。(限制30m内)</span> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">显示排行榜:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="radio" name="is_rank" value="1" title="显示" {if $detail.is_rank==1}checked{/if}> |
||||
|
<input type="radio" name="is_rank" value="0" title="隐藏" {if $detail.is_rank==0}checked{/if}> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">允许重复投票:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="radio" name="is_redo" value="0" title="当天不重复" {if $detail.is_redo==0}checked{/if}> |
||||
|
<input type="radio" name="is_redo" value="1" title="全部不重复" {if $detail.is_redo==1}checked{/if}> |
||||
|
<input type="radio" name="is_redo" value="2" title="可重复" {if $detail.is_redo==2}checked{/if}> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">投票方式:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="radio" name="vote_type" value="0" title="每天" {if $detail.vote_type==0}checked{/if}> |
||||
|
<input type="radio" name="vote_type" value="1" title="总共" {if $detail.vote_type==1}checked{/if} > |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label"></label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="number" id="vote_num" name="vote_num" class="layui-input" placeholder="次数" value="{$detail.vote_num}" /> |
||||
|
</div> |
||||
|
<label class="layui-form-label">次</label> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label for="title" class="layui-form-label">基础浏览数:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="number" name="base_visit" id="base_visit" value="{$detail.base_visit}" lay-verType="tips" lay-verify="required" autocomplete="off" class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">状态:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="radio" name="status" value="1" title="显示" {if $detail.status==1}checked{/if}> |
||||
|
<input type="radio" name="status" value="0" title="隐藏" {if $detail.status==0}checked{/if}> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label for="content" class="layui-form-label">资料内容:</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<textarea name="content" id="content" lay-verify="content">{$detail.content}</textarea> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="layui-form-item layui-hide"> |
||||
|
<input type="button" lay-submit lay-filter="addSubmit" id="addSubmit" value="确认"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<script src="__PUBLIC__/static/common/js/area.js"></script> |
||||
|
<script> |
||||
|
layui.config({ |
||||
|
base: "/static/lib/" |
||||
|
|
||||
|
}).extend({ |
||||
|
likeedit: "likeedit/likeedit", |
||||
|
likeArea: "likeArea/likeArea", |
||||
|
}).use(["likeedit","likeArea", "form",'laydate'], function(){ |
||||
|
var form = layui.form; |
||||
|
var likeedit = layui.likeedit; |
||||
|
var likeArea = layui.likeArea; |
||||
|
var laydate = layui.laydate |
||||
|
var content = likeedit.build("content", { |
||||
|
uploadImage: { |
||||
|
url: '{:url("file/lists")}?type=10' |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
// 时间组件 |
||||
|
laydate.render({type:'datetime' ,elem:'#startTime', trigger:'click'}); |
||||
|
laydate.render({type:'datetime' ,elem:'#endTime' ,trigger: 'click'}); |
||||
|
|
||||
|
|
||||
|
form.verify({ |
||||
|
content: function() { |
||||
|
likeedit.sync(content) |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
like.delUpload(); |
||||
|
// $(document).on("click", ".add-upload-image", function () { |
||||
|
// like.imageUpload({ |
||||
|
// limit: 1, |
||||
|
// field: "image", |
||||
|
// that: $(this) |
||||
|
// }); |
||||
|
// }); |
||||
|
|
||||
|
// 商品封面图 |
||||
|
$(document).on("click", "#image", function () { |
||||
|
like.imageUpload({ |
||||
|
limit: 1, |
||||
|
field: "image", |
||||
|
that: $(this), |
||||
|
content: '{:url("file/lists")}?type=10' |
||||
|
}); |
||||
|
}) |
||||
|
// 商品轮播图 |
||||
|
$(document).on("click", "#images", function () { |
||||
|
like.imageUpload({ |
||||
|
limit: 5, |
||||
|
field: "goods_image[]", |
||||
|
that: $(this), |
||||
|
content: '{:url("file/lists")}?type=10' |
||||
|
}); |
||||
|
}) |
||||
|
// 商品视频 |
||||
|
$(document).on("click", "#video", function () { |
||||
|
like.videoUpload({ |
||||
|
limit: 1, |
||||
|
field: "video", |
||||
|
that: $(this), |
||||
|
content: '{:url("file/lists")}?type=20' |
||||
|
}); |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
//删除图片/证书 |
||||
|
$(document).on('click', '.pay-img-del-x', function () { |
||||
|
$(this).parent().siblings('input').val(''); |
||||
|
$(this).parent().siblings().css('display','block'); |
||||
|
$(this).parent().remove(); |
||||
|
}); |
||||
|
|
||||
|
//==========================================上传证书start========================================================= |
||||
|
|
||||
|
like.certUpload('.cert-add', '{:url("file/other")}?local=1&sub_dir=resource', '{$storageUrl}'); |
||||
|
//==========================================上传证书end=========================================================== |
||||
|
// 删除按钮的显示与隐藏 |
||||
|
$(document).on('mouseover', '.pay-img', function () { |
||||
|
$(this).next().show(); |
||||
|
}); |
||||
|
$(document).on('mouseout', '.pay-img', function () { |
||||
|
$(this).next().hide(); |
||||
|
}); |
||||
|
$(document).on('mouseover', '.pay-img-del-x', function () { |
||||
|
$(this).show(); |
||||
|
}); |
||||
|
$(document).on('mouseout', '.pay-img-del-x', function () { |
||||
|
$(this).hide(); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
likeArea.init( |
||||
|
"province", "city", "district", "province_id", "city_id", "district_id", |
||||
|
"", "", "" |
||||
|
); |
||||
|
likeArea.init( |
||||
|
"refund_province", "refund_city", "refund_district", "refund_province_id", "refund_city_id", "refund_district_id", |
||||
|
"", "", "" |
||||
|
); |
||||
|
|
||||
|
}) |
||||
|
</script> |
||||
@ -0,0 +1,207 @@ |
|||||
|
{layout name="layout1" /} |
||||
|
|
||||
|
<div class="wrapper"> |
||||
|
<div class="layui-card"> |
||||
|
<!-- 操作提示 --> |
||||
|
<div class="layui-card-body"> |
||||
|
<div class="layui-collapse" style="border:1px dashed #c4c4c4"> |
||||
|
<div class="layui-colla-item"> |
||||
|
<h2 class="layui-colla-title like-layui-colla-title">操作提示</h2> |
||||
|
<div class="layui-colla-content layui-show"> |
||||
|
<p>*投票活动。</p> |
||||
|
<p>*最新发布的在前。</p> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<!-- 搜索区域 --> |
||||
|
<div class="layui-card-body layui-form"> |
||||
|
<div class="layui-form-item"> |
||||
|
<div class="layui-inline"> |
||||
|
<label for="title" class="layui-form-label">投票活动标题:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" id="title" name="title" autocomplete="off" class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-inline"> |
||||
|
<a class="layui-btn layui-btn-sm layui-btn-normal" lay-submit lay-filter="search">搜索</a> |
||||
|
<a class="layui-btn layui-btn-sm layui-btn-primary" lay-submit lay-filter="clear-search">重置</a> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<!-- 主体区域 --> |
||||
|
<div class="layui-card-body"> |
||||
|
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm layEvent" lay-event="add">新增活动</button> |
||||
|
|
||||
|
<table id="like-table-lists" lay-filter="like-table-lists"></table> |
||||
|
<script type="text/html" id="table-image"> |
||||
|
{{# if(d.image){ }} |
||||
|
<img src="{{d.image}}" alt="图" style="width:28px;height:28px;"> |
||||
|
{{# } }} |
||||
|
</script> |
||||
|
|
||||
|
<script type="text/html" id="table-operation"> |
||||
|
<a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="edit">编辑</a> |
||||
|
{{# if(d.status == 1){ }}<a class="layui-btn layui-btn-normal layui-btn-sm layui-btn-warm" lay-event="hide">隐藏</a>{{# } }} |
||||
|
{{# if(d.status == 0){ }}<a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="hide">显示</a>{{# } }} |
||||
|
<a class="layui-btn layui-btn-danger layui-btn-sm" lay-event="del">删除</a> |
||||
|
</script> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<script> |
||||
|
layui.use(["table", "form"], function(){ |
||||
|
var table = layui.table; |
||||
|
var form = layui.form; |
||||
|
|
||||
|
|
||||
|
like.tableLists("#like-table-lists", "{:url()}", [ |
||||
|
{field:"id", width:60, title:"ID"} |
||||
|
,{field:"title", width:200, align:"center", title:"标题"} |
||||
|
,{field:"image", width:100, align:"center", title:"封面图", templet:"#table-image"} |
||||
|
,{field:"start_time", width:180, align:"center", title:"开始时间"} |
||||
|
,{field:"end_time", width:180, align:"center", title:"结束时间"} |
||||
|
,{field:"is_rank", width:150, align:"center", title:"显示排行榜"} |
||||
|
,{field:"is_redo", width:150, align:"center", title:"重复投票"} |
||||
|
,{field:"vote_str", width:180, align:"center", title:"投票规则"} |
||||
|
,{field:"vote_total", width:180, align:"center", title:"投票数"} |
||||
|
,{field:"views", width:180, align:"center", title:"浏览数"} |
||||
|
,{field:"status", width:180, align:"center", title:"状态"} |
||||
|
,{field:"add_time", width:180, align:"center", title:"创建时间"} |
||||
|
,{title:"操作", width:200, align:"center", fixed:"right", toolbar:"#table-operation"} |
||||
|
]); |
||||
|
|
||||
|
|
||||
|
var active = { |
||||
|
add: function() { |
||||
|
layer.open({ |
||||
|
type: 2 |
||||
|
,title: "新增活动" |
||||
|
,content: "{:url('vote.Vote/add')}" |
||||
|
,area: ["90%", "90%"] |
||||
|
,btn: ["确定", "取消"] |
||||
|
,yes: function(index, layero){ |
||||
|
var iframeWindow = window["layui-layer-iframe" + index]; |
||||
|
var submit = layero.find("iframe").contents().find("#addSubmit"); |
||||
|
iframeWindow.layui.form.on("submit(addSubmit)", function(data){ |
||||
|
like.ajax({ |
||||
|
url: "{:url('vote.Vote/add')}", |
||||
|
data: data.field, |
||||
|
type: "POST", |
||||
|
success:function(res) { |
||||
|
if(res.code === 1) { |
||||
|
layui.layer.msg(res.msg); |
||||
|
layer.close(index); |
||||
|
table.reload("like-table-lists", { |
||||
|
where: {}, |
||||
|
page: { cur: 1 } |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
submit.trigger("click"); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
edit: function(obj) { |
||||
|
layer.open({ |
||||
|
type: 2 |
||||
|
,title: "编辑活动" |
||||
|
,content: "{:url('vote.Vote/edit')}?id=" + obj.data.id |
||||
|
,area: ["90%", "90%"] |
||||
|
,btn: ["确定", "取消"] |
||||
|
,yes: function(index, layero){ |
||||
|
var iframeWindow = window["layui-layer-iframe" + index]; |
||||
|
var submit = layero.find("iframe").contents().find("#addSubmit"); |
||||
|
iframeWindow.layui.form.on("submit(addSubmit)", function(data){ |
||||
|
data.field['id'] = obj.data.id; |
||||
|
like.ajax({ |
||||
|
url: "{:url('vote.Vote/edit')}", |
||||
|
data: data.field, |
||||
|
type: "POST", |
||||
|
success:function(res) { |
||||
|
if(res.code === 1) { |
||||
|
layui.layer.msg(res.msg); |
||||
|
layer.close(index); |
||||
|
table.reload("like-table-lists", { |
||||
|
where: {}, |
||||
|
page: { cur: 1 } |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
submit.trigger("click"); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
del: function(obj) { |
||||
|
layer.confirm("确定删除活动:"+obj.data.title, function(index) { |
||||
|
like.ajax({ |
||||
|
url: "{:url('vote.Vote/del')}", |
||||
|
data: {id: obj.data.id}, |
||||
|
type: "POST", |
||||
|
success: function (res) { |
||||
|
if (res.code === 1) { |
||||
|
layui.layer.msg(res.msg); |
||||
|
layer.close(index); |
||||
|
obj.del(); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
layer.close(index); |
||||
|
}) |
||||
|
}, |
||||
|
hide: function(obj) { |
||||
|
var text = obj.data.status === 1 ? '确定隐藏:' : '确定显示:'; |
||||
|
var status = obj.data.status === 1 ? 0 : 1; |
||||
|
layer.confirm(text+obj.data.title, function(index) { |
||||
|
like.ajax({ |
||||
|
url: "{:url('vote.Vote/status')}", |
||||
|
data: {id: obj.data.id,status:status}, |
||||
|
type: "POST", |
||||
|
success: function (res) { |
||||
|
if (res.code === 1) { |
||||
|
layui.layer.msg(res.msg); |
||||
|
layer.close(index); |
||||
|
table.reload("like-table-lists", { |
||||
|
where: {}, |
||||
|
page: { cur: 1 } |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
layer.close(index); |
||||
|
}) |
||||
|
} |
||||
|
}; |
||||
|
like.eventClick(active); |
||||
|
|
||||
|
form.on("submit(search)", function(data){ |
||||
|
table.reload("like-table-lists", { |
||||
|
where: data.field, |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
form.on("submit(clear-search)", function(){ |
||||
|
$("#title").val(""); |
||||
|
form.render("select"); |
||||
|
table.reload("like-table-lists", { |
||||
|
where: {}, |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
}) |
||||
|
</script> |
||||
@ -0,0 +1,221 @@ |
|||||
|
{layout name="layout2" /} |
||||
|
<style> |
||||
|
.layui-form-label{width: 100px} |
||||
|
.layui-form-item .layui-input-inline { width: 340px; } |
||||
|
.pay-li { |
||||
|
float: left; |
||||
|
opacity: 1; |
||||
|
position: relative; |
||||
|
} |
||||
|
.pay-img { |
||||
|
width: 80px; |
||||
|
height: 80px; |
||||
|
padding: 4px; |
||||
|
} |
||||
|
.pay-img-del-x { |
||||
|
position: absolute; |
||||
|
z-index: 100; |
||||
|
top: -4px; |
||||
|
right: -2px; |
||||
|
width: 20px; |
||||
|
height: 20px; |
||||
|
font-size: 16px; |
||||
|
line-height: 16px; |
||||
|
color: #fff; |
||||
|
text-align: center; |
||||
|
cursor: pointer; |
||||
|
background: hsla(0, 0%, 60%, .6); |
||||
|
border-radius: 10px; |
||||
|
} |
||||
|
.upload-cert-a{ |
||||
|
cursor: pointer; |
||||
|
position: absolute; |
||||
|
z-index: 100; |
||||
|
top: 58px; |
||||
|
right: -10%; |
||||
|
width: 100px; |
||||
|
height: 20px; |
||||
|
font-size: 8px; |
||||
|
line-height: 16px; |
||||
|
text-align: center; |
||||
|
border-radius: 10px; |
||||
|
color: #4e8bff; |
||||
|
} |
||||
|
.upload-cert-a:hover { |
||||
|
color: #0641cb; |
||||
|
} |
||||
|
.pay-cert{ |
||||
|
height:80px;line-height:80px |
||||
|
} |
||||
|
.cert-add,.key-add{ |
||||
|
height: 80px; |
||||
|
width: 80px; |
||||
|
float: left; |
||||
|
opacity: 1; |
||||
|
position: relative; |
||||
|
border:1px dashed #a0a0a0; |
||||
|
background-image:url('/static/common/image/default/add_file.png'); |
||||
|
background-repeat: no-repeat; |
||||
|
background-position: 50% 35%; |
||||
|
background-size:40px 40px; |
||||
|
margin: 4px; |
||||
|
text-align: center; |
||||
|
} |
||||
|
</style> |
||||
|
|
||||
|
<div class="layui-card layui-form" style="box-shadow:none;"> |
||||
|
<div class="layui-card-body"> |
||||
|
<div class="layui-form-item"> |
||||
|
<label for="name" class="layui-form-label"><span style="color:red;">*</span>名称:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" name="name" id="name" lay-verType="tips" lay-verify="required" autocomplete="off" class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label for="vote_id" class="layui-form-label"><span style="color:red;">*</span>所属活动:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<select name="vote_id" id="vote_id" lay-verType="tips" lay-verify="required" lay-filter="vote_id"> |
||||
|
<option value="">全部</option> |
||||
|
{volist name="votes" id="vo"} |
||||
|
<option value="{$vo.id}">{$vo.title}</option> |
||||
|
{/volist} |
||||
|
</select> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">头像:</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<div class="like-upload-image" switch-tab="0" lay-verType="tips"> |
||||
|
<div class="upload-image-elem"><a class="add-upload-image" id="avatar"> + 添加图片</a></div> |
||||
|
</div> |
||||
|
<div class="layui-form-mid layui-word-aux">建议尺寸:500*500像</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item" style="margin-bottom: 0px"> |
||||
|
<label class="layui-form-label"><span class="form-label-asterisk">*</span>详情轮播图:</label> |
||||
|
<div class="layui-input-block" id="goodsImageContainer"> |
||||
|
<div class="like-upload-image"> |
||||
|
<div class="upload-image-elem"><a class="add-upload-image" id="images"> + 添加图片</a></div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label"></label> |
||||
|
<span style="color: #a3a3a3;font-size: 9px">建议尺寸:800*800像素,最多上传5张</span> |
||||
|
</div> |
||||
|
|
||||
|
<!--商品视频--> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">视频:</label> |
||||
|
<div class="layui-input-block" id="videoContainer"> |
||||
|
<div class="like-upload-video"> |
||||
|
<div class="upload-image-elem"><a class="add-upload-video" id="video"> + 添加视频</a></div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label"></label> |
||||
|
<span style="color: #a3a3a3;font-size: 9px">宣传视频,在投票详情页面播放。(限制30m内)</span> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label for="base_visit" class="layui-form-label">基础浏览数:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="number" name="base_visit" id="base_visit" lay-verType="tips" lay-verify="required" autocomplete="off" class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">状态:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="radio" name="status" value="1" title="显示"> |
||||
|
<input type="radio" name="status" value="0" title="隐藏" checked> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label for="intro" class="layui-form-label">简介:</label> |
||||
|
<div class="layui-input-block" > |
||||
|
<textarea style="width: 50%" placeholder="请输入简介" name="intro" id="intro" class="layui-textarea" rows="6"></textarea> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item layui-hide"> |
||||
|
<input type="button" lay-submit lay-filter="addSubmit" id="addSubmit" value="确认"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<script src="__PUBLIC__/static/common/js/area.js"></script> |
||||
|
<script> |
||||
|
layui.config({ |
||||
|
base: "/static/lib/" |
||||
|
|
||||
|
}).extend({ |
||||
|
likeedit: "likeedit/likeedit", |
||||
|
likeArea: "likeArea/likeArea", |
||||
|
}).use(["likeedit","likeArea", "form",'laydate'], function(){ |
||||
|
var form = layui.form; |
||||
|
|
||||
|
like.delUpload(); |
||||
|
|
||||
|
// 商品封面图 |
||||
|
$(document).on("click", "#avatar", function () { |
||||
|
like.imageUpload({ |
||||
|
limit: 1, |
||||
|
field: "avatar", |
||||
|
that: $(this), |
||||
|
content: '{:url("file/lists")}?type=10' |
||||
|
}); |
||||
|
}) |
||||
|
// 商品轮播图 |
||||
|
$(document).on("click", "#images", function () { |
||||
|
like.imageUpload({ |
||||
|
limit: 5, |
||||
|
field: "goods_image[]", |
||||
|
that: $(this), |
||||
|
content: '{:url("file/lists")}?type=10' |
||||
|
}); |
||||
|
}) |
||||
|
// 商品视频 |
||||
|
$(document).on("click", "#video", function () { |
||||
|
like.videoUpload({ |
||||
|
limit: 1, |
||||
|
field: "video", |
||||
|
that: $(this), |
||||
|
content: '{:url("file/lists")}?type=20' |
||||
|
}); |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
//删除图片/证书 |
||||
|
$(document).on('click', '.pay-img-del-x', function () { |
||||
|
$(this).parent().siblings('input').val(''); |
||||
|
$(this).parent().siblings().css('display','block'); |
||||
|
$(this).parent().remove(); |
||||
|
}); |
||||
|
|
||||
|
//==========================================上传证书start========================================================= |
||||
|
|
||||
|
like.certUpload('.cert-add', '{:url("file/other")}?local=1&sub_dir=resource', '{$storageUrl}'); |
||||
|
//==========================================上传证书end=========================================================== |
||||
|
// 删除按钮的显示与隐藏 |
||||
|
$(document).on('mouseover', '.pay-img', function () { |
||||
|
$(this).next().show(); |
||||
|
}); |
||||
|
$(document).on('mouseout', '.pay-img', function () { |
||||
|
$(this).next().hide(); |
||||
|
}); |
||||
|
$(document).on('mouseover', '.pay-img-del-x', function () { |
||||
|
$(this).show(); |
||||
|
}); |
||||
|
$(document).on('mouseout', '.pay-img-del-x', function () { |
||||
|
$(this).hide(); |
||||
|
}); |
||||
|
|
||||
|
}) |
||||
|
</script> |
||||
@ -0,0 +1,282 @@ |
|||||
|
{layout name="layout2" /} |
||||
|
<style> |
||||
|
.layui-form-label{width: 100px} |
||||
|
.layui-form-item .layui-input-inline { width: 340px; } |
||||
|
.pay-li { |
||||
|
float: left; |
||||
|
opacity: 1; |
||||
|
position: relative; |
||||
|
} |
||||
|
.pay-img { |
||||
|
width: 80px; |
||||
|
height: 80px; |
||||
|
padding: 4px; |
||||
|
} |
||||
|
.pay-img-del-x { |
||||
|
position: absolute; |
||||
|
z-index: 100; |
||||
|
top: -4px; |
||||
|
right: -2px; |
||||
|
width: 20px; |
||||
|
height: 20px; |
||||
|
font-size: 16px; |
||||
|
line-height: 16px; |
||||
|
color: #fff; |
||||
|
text-align: center; |
||||
|
cursor: pointer; |
||||
|
background: hsla(0, 0%, 60%, .6); |
||||
|
border-radius: 10px; |
||||
|
} |
||||
|
.upload-cert-a{ |
||||
|
cursor: pointer; |
||||
|
position: absolute; |
||||
|
z-index: 100; |
||||
|
top: 58px; |
||||
|
right: -10%; |
||||
|
width: 100px; |
||||
|
height: 20px; |
||||
|
font-size: 8px; |
||||
|
line-height: 16px; |
||||
|
text-align: center; |
||||
|
border-radius: 10px; |
||||
|
color: #4e8bff; |
||||
|
} |
||||
|
.upload-cert-a:hover { |
||||
|
color: #0641cb; |
||||
|
} |
||||
|
.pay-cert{ |
||||
|
height:80px;line-height:80px |
||||
|
} |
||||
|
.cert-add,.key-add{ |
||||
|
height: 80px; |
||||
|
width: 80px; |
||||
|
float: left; |
||||
|
opacity: 1; |
||||
|
position: relative; |
||||
|
border:1px dashed #a0a0a0; |
||||
|
background-image:url('/static/common/image/default/add_file.png'); |
||||
|
background-repeat: no-repeat; |
||||
|
background-position: 50% 35%; |
||||
|
background-size:40px 40px; |
||||
|
margin: 4px; |
||||
|
text-align: center; |
||||
|
} |
||||
|
</style> |
||||
|
|
||||
|
<div class="layui-card layui-form" style="box-shadow:none;"> |
||||
|
<div class="layui-card-body"> |
||||
|
<div class="layui-form-item"> |
||||
|
<label for="name" class="layui-form-label"><span style="color:red;">*</span>名称:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" name="name" id="name" lay-verType="tips" lay-verify="required" value="{$detail['name']}" autocomplete="off" class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label for="vote_id" class="layui-form-label"><span style="color:red;">*</span>所属活动:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<select name="vote_id" id="vote_id" lay-verType="tips" lay-verify="required" lay-filter="vote_id" disabled> |
||||
|
<option value="">全部</option> |
||||
|
{volist name="votes" id="vo"} |
||||
|
<option value="{$vo.id}" {if $detail.vote_id==$vo.id}selected{/if}>{$vo.title}</option> |
||||
|
{/volist} |
||||
|
</select> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">头像:</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<div class="like-upload-image" switch-tab="0" lay-verType="tips"> |
||||
|
{if $detail.avatar} |
||||
|
<div class="upload-image-div"> |
||||
|
<img src="{$detail.avatar}" alt="img"> |
||||
|
<input type="hidden" name="avatar" value="{$detail.avatar}"> |
||||
|
<div class="del-upload-btn">x</div> |
||||
|
</div> |
||||
|
{/if} |
||||
|
<div class="upload-image-elem"><a class="add-upload-image" id="avatar"> + 添加图片</a></div> |
||||
|
</div> |
||||
|
<div class="layui-form-mid layui-word-aux">建议尺寸:500*500像</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item" style="margin-bottom: 0px"> |
||||
|
<label class="layui-form-label"><span class="form-label-asterisk">*</span>轮播图:</label> |
||||
|
<div class="layui-input-block" id="goodsImageContainer"> |
||||
|
{foreach $detail['images_arr'] as $val} |
||||
|
<div class="upload-image-div"> |
||||
|
<img src="{$val}" alt="img" /> |
||||
|
<input type="hidden" name="goods_image[]" value="{$val}"> |
||||
|
<div class="del-upload-btn">x</div> |
||||
|
</div> |
||||
|
{/foreach} |
||||
|
<div class="like-upload-image"> |
||||
|
<div class="upload-image-elem"><a class="add-upload-image" id="images"> + 添加图片</a></div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label"></label> |
||||
|
<span style="color: #a3a3a3;font-size: 9px">建议尺寸:800*800像素,最多上传5张</span> |
||||
|
</div> |
||||
|
|
||||
|
<!--商品视频--> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">宣传视频:</label> |
||||
|
<div class="layui-input-block" id="videoContainer"> |
||||
|
<div class="like-upload-video"> |
||||
|
{if $detail.video} |
||||
|
<div class="upload-video-div"> |
||||
|
<video src="{$detail.video}"></video> |
||||
|
<input type="hidden" name="video" value="{$detail.video}"> |
||||
|
<div class="del-upload-btn">x</div> |
||||
|
</div> |
||||
|
{/if} |
||||
|
<div class="upload-image-elem"><a class="add-upload-video" id="video"> + 添加视频</a></div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label"></label> |
||||
|
<span style="color: #a3a3a3;font-size: 9px">宣传视频,在投票详情页面播放。(限制30m内)</span> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label for="base_visit" class="layui-form-label">基础浏览数:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="number" name="base_visit" id="base_visit" value="{$detail.base_visit}" lay-verType="tips" lay-verify="required" autocomplete="off" class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">状态:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="radio" name="status" value="1" title="显示" {if $detail.status==1}checked{/if}> |
||||
|
<input type="radio" name="status" value="0" title="隐藏" {if $detail.status==0}checked{/if}> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label for="intro" class="layui-form-label">简介:</label> |
||||
|
<div class="layui-input-block" > |
||||
|
<textarea style="width: 50%" placeholder="请输入简介" name="intro" id="intro" class="layui-textarea" rows="6">{$detail.intro}</textarea> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item layui-hide"> |
||||
|
<input type="button" lay-submit lay-filter="addSubmit" id="addSubmit" value="确认"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<script src="__PUBLIC__/static/common/js/area.js"></script> |
||||
|
<script> |
||||
|
layui.config({ |
||||
|
base: "/static/lib/" |
||||
|
|
||||
|
}).extend({ |
||||
|
likeedit: "likeedit/likeedit", |
||||
|
likeArea: "likeArea/likeArea", |
||||
|
}).use(["likeedit","likeArea", "form",'laydate'], function(){ |
||||
|
var form = layui.form; |
||||
|
var likeedit = layui.likeedit; |
||||
|
var likeArea = layui.likeArea; |
||||
|
var laydate = layui.laydate |
||||
|
var content = likeedit.build("content", { |
||||
|
uploadImage: { |
||||
|
url: '{:url("file/lists")}?type=10' |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
// 时间组件 |
||||
|
laydate.render({type:'datetime' ,elem:'#startTime', trigger:'click'}); |
||||
|
laydate.render({type:'datetime' ,elem:'#endTime' ,trigger: 'click'}); |
||||
|
|
||||
|
|
||||
|
form.verify({ |
||||
|
content: function() { |
||||
|
likeedit.sync(content) |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
like.delUpload(); |
||||
|
// $(document).on("click", ".add-upload-image", function () { |
||||
|
// like.imageUpload({ |
||||
|
// limit: 1, |
||||
|
// field: "image", |
||||
|
// that: $(this) |
||||
|
// }); |
||||
|
// }); |
||||
|
|
||||
|
// 商品封面图 |
||||
|
$(document).on("click", "#avatar", function () { |
||||
|
like.imageUpload({ |
||||
|
limit: 1, |
||||
|
field: "avatar", |
||||
|
that: $(this), |
||||
|
content: '{:url("file/lists")}?type=10' |
||||
|
}); |
||||
|
}) |
||||
|
// 商品轮播图 |
||||
|
$(document).on("click", "#images", function () { |
||||
|
like.imageUpload({ |
||||
|
limit: 5, |
||||
|
field: "goods_image[]", |
||||
|
that: $(this), |
||||
|
content: '{:url("file/lists")}?type=10' |
||||
|
}); |
||||
|
}) |
||||
|
// 商品视频 |
||||
|
$(document).on("click", "#video", function () { |
||||
|
like.videoUpload({ |
||||
|
limit: 1, |
||||
|
field: "video", |
||||
|
that: $(this), |
||||
|
content: '{:url("file/lists")}?type=20' |
||||
|
}); |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
//删除图片/证书 |
||||
|
$(document).on('click', '.pay-img-del-x', function () { |
||||
|
$(this).parent().siblings('input').val(''); |
||||
|
$(this).parent().siblings().css('display','block'); |
||||
|
$(this).parent().remove(); |
||||
|
}); |
||||
|
|
||||
|
//==========================================上传证书start========================================================= |
||||
|
|
||||
|
like.certUpload('.cert-add', '{:url("file/other")}?local=1&sub_dir=resource', '{$storageUrl}'); |
||||
|
//==========================================上传证书end=========================================================== |
||||
|
// 删除按钮的显示与隐藏 |
||||
|
$(document).on('mouseover', '.pay-img', function () { |
||||
|
$(this).next().show(); |
||||
|
}); |
||||
|
$(document).on('mouseout', '.pay-img', function () { |
||||
|
$(this).next().hide(); |
||||
|
}); |
||||
|
$(document).on('mouseover', '.pay-img-del-x', function () { |
||||
|
$(this).show(); |
||||
|
}); |
||||
|
$(document).on('mouseout', '.pay-img-del-x', function () { |
||||
|
$(this).hide(); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
likeArea.init( |
||||
|
"province", "city", "district", "province_id", "city_id", "district_id", |
||||
|
"", "", "" |
||||
|
); |
||||
|
likeArea.init( |
||||
|
"refund_province", "refund_city", "refund_district", "refund_province_id", "refund_city_id", "refund_district_id", |
||||
|
"", "", "" |
||||
|
); |
||||
|
|
||||
|
}) |
||||
|
</script> |
||||
@ -0,0 +1,215 @@ |
|||||
|
{layout name="layout1" /} |
||||
|
|
||||
|
<div class="wrapper"> |
||||
|
<div class="layui-card"> |
||||
|
<!-- 操作提示 --> |
||||
|
<div class="layui-card-body"> |
||||
|
<div class="layui-collapse" style="border:1px dashed #c4c4c4"> |
||||
|
<div class="layui-colla-item"> |
||||
|
<h2 class="layui-colla-title like-layui-colla-title">操作提示</h2> |
||||
|
<div class="layui-colla-content layui-show"> |
||||
|
<p>*投票活动选手。</p> |
||||
|
<p>*最新发布的在前。</p> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<!-- 搜索区域 --> |
||||
|
<div class="layui-card-body layui-form"> |
||||
|
<div class="layui-form-item"> |
||||
|
<div class="layui-inline"> |
||||
|
<label for="title" class="layui-form-label">选手名称:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" id="title" name="title" autocomplete="off" class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-inline"> |
||||
|
<label for="cid" class="layui-form-label">所属活动:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<select name="cid" id="cid"> |
||||
|
<option value="">全部</option> |
||||
|
{volist name="votes" id="vo"} |
||||
|
<option value="{$vo.id}">{$vo.title}</option> |
||||
|
{/volist} |
||||
|
</select> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-inline"> |
||||
|
<a class="layui-btn layui-btn-sm layui-btn-normal" lay-submit lay-filter="search">搜索</a> |
||||
|
<a class="layui-btn layui-btn-sm layui-btn-primary" lay-submit lay-filter="clear-search">重置</a> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<!-- 主体区域 --> |
||||
|
<div class="layui-card-body"> |
||||
|
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm layEvent" lay-event="add">新增选手</button> |
||||
|
|
||||
|
<table id="like-table-lists" lay-filter="like-table-lists"></table> |
||||
|
<script type="text/html" id="table-image"> |
||||
|
{{# if(d.avatar){ }} |
||||
|
<img src="{{d.avatar}}" alt="图" style="width:28px;height:28px;"> |
||||
|
{{# } }} |
||||
|
</script> |
||||
|
|
||||
|
<script type="text/html" id="table-operation"> |
||||
|
<a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="edit">编辑</a> |
||||
|
{{# if(d.status == 1){ }}<a class="layui-btn layui-btn-normal layui-btn-sm layui-btn-warm" lay-event="hide">隐藏</a>{{# } }} |
||||
|
{{# if(d.status == 0){ }}<a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="hide">显示</a>{{# } }} |
||||
|
<a class="layui-btn layui-btn-danger layui-btn-sm" lay-event="del">删除</a> |
||||
|
</script> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<script> |
||||
|
layui.use(["table", "form"], function(){ |
||||
|
var table = layui.table; |
||||
|
var form = layui.form; |
||||
|
|
||||
|
|
||||
|
like.tableLists("#like-table-lists", "{:url()}", [ |
||||
|
{field:"id", width:60, title:"ID"} |
||||
|
,{field:"vote_title", width:200, align:"center", title:"所属活动"} |
||||
|
,{field:"name", width:200, align:"center", title:"姓名"} |
||||
|
,{field:"image", width:100, align:"center", title:"封面图", templet:"#table-image"} |
||||
|
,{field:"intro", width:180, align:"center", title:"参赛介绍"} |
||||
|
,{field:"vote_num", width:180, align:"center", title:"投票数"} |
||||
|
,{field:"views", width:180, align:"center", title:"浏览数"} |
||||
|
,{field:"status", width:180, align:"center", title:"状态"} |
||||
|
,{field:"add_time", width:180, align:"center", title:"创建时间"} |
||||
|
,{title:"操作", width:200, align:"center", fixed:"right", toolbar:"#table-operation"} |
||||
|
]); |
||||
|
|
||||
|
|
||||
|
var active = { |
||||
|
add: function() { |
||||
|
layer.open({ |
||||
|
type: 2 |
||||
|
,title: "新增活动" |
||||
|
,content: "{:url('vote.VotePlayer/add')}" |
||||
|
,area: ["90%", "90%"] |
||||
|
,btn: ["确定", "取消"] |
||||
|
,yes: function(index, layero){ |
||||
|
var iframeWindow = window["layui-layer-iframe" + index]; |
||||
|
var submit = layero.find("iframe").contents().find("#addSubmit"); |
||||
|
iframeWindow.layui.form.on("submit(addSubmit)", function(data){ |
||||
|
like.ajax({ |
||||
|
url: "{:url('vote.VotePlayer/add')}", |
||||
|
data: data.field, |
||||
|
type: "POST", |
||||
|
success:function(res) { |
||||
|
if(res.code === 1) { |
||||
|
layui.layer.msg(res.msg); |
||||
|
layer.close(index); |
||||
|
table.reload("like-table-lists", { |
||||
|
where: {}, |
||||
|
page: { cur: 1 } |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
submit.trigger("click"); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
edit: function(obj) { |
||||
|
layer.open({ |
||||
|
type: 2 |
||||
|
,title: "编辑活动" |
||||
|
,content: "{:url('vote.VotePlayer/edit')}?id=" + obj.data.id |
||||
|
,area: ["90%", "90%"] |
||||
|
,btn: ["确定", "取消"] |
||||
|
,yes: function(index, layero){ |
||||
|
var iframeWindow = window["layui-layer-iframe" + index]; |
||||
|
var submit = layero.find("iframe").contents().find("#addSubmit"); |
||||
|
iframeWindow.layui.form.on("submit(addSubmit)", function(data){ |
||||
|
data.field['id'] = obj.data.id; |
||||
|
like.ajax({ |
||||
|
url: "{:url('vote.VotePlayer/edit')}", |
||||
|
data: data.field, |
||||
|
type: "POST", |
||||
|
success:function(res) { |
||||
|
if(res.code === 1) { |
||||
|
layui.layer.msg(res.msg); |
||||
|
layer.close(index); |
||||
|
table.reload("like-table-lists", { |
||||
|
where: {}, |
||||
|
page: { cur: 1 } |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
submit.trigger("click"); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
del: function(obj) { |
||||
|
layer.confirm("确定删除选手:"+obj.data.title, function(index) { |
||||
|
like.ajax({ |
||||
|
url: "{:url('vote.VotePlayer/del')}", |
||||
|
data: {id: obj.data.id}, |
||||
|
type: "POST", |
||||
|
success: function (res) { |
||||
|
if (res.code === 1) { |
||||
|
layui.layer.msg(res.msg); |
||||
|
layer.close(index); |
||||
|
obj.del(); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
layer.close(index); |
||||
|
}) |
||||
|
}, |
||||
|
hide: function(obj) { |
||||
|
var text = obj.data.status === 1 ? '确定隐藏:' : '确定显示:'; |
||||
|
var status = obj.data.status === 1 ? 0 : 1; |
||||
|
layer.confirm(text+obj.data.title, function(index) { |
||||
|
like.ajax({ |
||||
|
url: "{:url('vote.VotePlayer/status')}", |
||||
|
data: {id: obj.data.id,status:status}, |
||||
|
type: "POST", |
||||
|
success: function (res) { |
||||
|
if (res.code === 1) { |
||||
|
layui.layer.msg(res.msg); |
||||
|
layer.close(index); |
||||
|
table.reload("like-table-lists", { |
||||
|
where: {}, |
||||
|
page: { cur: 1 } |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
layer.close(index); |
||||
|
}) |
||||
|
} |
||||
|
}; |
||||
|
like.eventClick(active); |
||||
|
|
||||
|
form.on("submit(search)", function(data){ |
||||
|
table.reload("like-table-lists", { |
||||
|
where: data.field, |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
form.on("submit(clear-search)", function(){ |
||||
|
$("#title").val(""); |
||||
|
form.render("select"); |
||||
|
table.reload("like-table-lists", { |
||||
|
where: {}, |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
}) |
||||
|
</script> |
||||
@ -0,0 +1,88 @@ |
|||||
|
<?php |
||||
|
|
||||
|
|
||||
|
namespace app\api\controller; |
||||
|
|
||||
|
|
||||
|
|
||||
|
use app\api\logic\ArticleLogic; |
||||
|
use app\api\logic\VoteLogic; |
||||
|
use app\common\basics\Api; |
||||
|
use app\common\server\JsonServer; |
||||
|
|
||||
|
class Vote extends Api |
||||
|
{ |
||||
|
public $like_not_need_login = ['lists', 'detail','players','playerDetail','rank','vote']; |
||||
|
|
||||
|
/** |
||||
|
* @Notes: 文章列表 |
||||
|
* @Author: 张无忌 |
||||
|
*/ |
||||
|
public function lists() |
||||
|
{ |
||||
|
$get = $this->request->get(); |
||||
|
$get['page_no'] = $this->page_no; |
||||
|
$get['page_size'] = $this->page_size; |
||||
|
$lists = VoteLogic::lists($get); |
||||
|
return JsonServer::success('获取成功', $lists); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Notes: 文章详细 |
||||
|
* @Author: 张无忌 |
||||
|
*/ |
||||
|
public function detail() |
||||
|
{ |
||||
|
$id = $this->request->get('id'); |
||||
|
$detail = VoteLogic::detail($id,$this->user_id); |
||||
|
return JsonServer::success('获取成功', $detail); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @Notes: 文章详细 |
||||
|
* @Author: 张无忌 |
||||
|
*/ |
||||
|
public function players() |
||||
|
{ |
||||
|
$get = $this->request->get(); |
||||
|
$get['page_no'] = $this->page_no; |
||||
|
$get['page_size'] = $this->page_size; |
||||
|
$detail = VoteLogic::players($get,$this->user_id); |
||||
|
return JsonServer::success('获取成功', $detail); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Notes: 文章详细 |
||||
|
* @Author: 张无忌 |
||||
|
*/ |
||||
|
public function playerDetail() |
||||
|
{ |
||||
|
$id = $this->request->get('id'); |
||||
|
$detail = VoteLogic::playersDetail($id,$this->user_id); |
||||
|
return JsonServer::success('获取成功', $detail); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Notes: 文章详细 |
||||
|
* @Author: 张无忌 |
||||
|
*/ |
||||
|
public function vote() |
||||
|
{ |
||||
|
$id = $this->request->get('id'); |
||||
|
$detail = VoteLogic::vote($id,$this->user_id); |
||||
|
return JsonServer::success('获取成功', $detail); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Notes: 文章详细 |
||||
|
* @Author: 张无忌 |
||||
|
*/ |
||||
|
public function rank() |
||||
|
{ |
||||
|
$get = $this->request->get(); |
||||
|
$lists = VoteLogic::rank($get); |
||||
|
return JsonServer::success('获取成功', $lists); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,343 @@ |
|||||
|
<?php |
||||
|
|
||||
|
|
||||
|
namespace app\api\logic; |
||||
|
|
||||
|
|
||||
|
use app\common\basics\Logic; |
||||
|
use app\common\model\content\Article; |
||||
|
use app\common\model\content\ArticleCategory; |
||||
|
use app\common\model\content\Resource; |
||||
|
use app\common\model\content\ResourceCategory; |
||||
|
use app\common\model\user\User; |
||||
|
use app\common\model\user\UserResource; |
||||
|
use app\common\model\vote\Vote; |
||||
|
use app\common\model\vote\VoteLog; |
||||
|
use app\common\model\vote\VotePlayer; |
||||
|
use app\common\server\AreaServer; |
||||
|
use app\common\server\UrlServer; |
||||
|
use think\Db; |
||||
|
|
||||
|
class VoteLogic extends Logic |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @Notes: 文章列表 |
||||
|
* @Author: 张无忌 |
||||
|
* @param $get |
||||
|
* @return array |
||||
|
*/ |
||||
|
public static function lists($get) |
||||
|
{ |
||||
|
try { |
||||
|
|
||||
|
$where = [ |
||||
|
['status', '=', 1] |
||||
|
|
||||
|
]; |
||||
|
$order = [ |
||||
|
'add_time' => 'asc' |
||||
|
]; |
||||
|
|
||||
|
$model = new Vote(); |
||||
|
|
||||
|
$count = $model->alias('a')->where($where)->count(); |
||||
|
|
||||
|
$list = $model->alias('b') |
||||
|
->where($where) |
||||
|
->order($order) |
||||
|
->page($get['page_no'], $get['page_size']) |
||||
|
->select() |
||||
|
->toArray(); |
||||
|
|
||||
|
foreach ($list as &$item) { |
||||
|
$item['status_show'] = $item['start_time']>time()?"未开始":($item['end_time']<time() ? "已结束":"进行中" ); |
||||
|
$item['start_time_str'] = $item['start_time']? date("Y-m-d",$item['start_time']):""; |
||||
|
$item['end_time_str'] = $item['end_time']? date("Y-m-d",$item['end_time']):""; |
||||
|
$item['add_time'] = $item['add_time']? date("Y-m-d H:i:s",$item['add_time']):""; |
||||
|
$item['is_rank'] = $item['is_rank'] ? '显示' : '隐藏'; |
||||
|
$item['is_redo'] = $item['is_redo']==0 ? '当天不可重复' : ($item['is_redo']==1?"全部不重复":"可重复"); |
||||
|
$item['vote_str'] = ($item['vote_type']==0 ? '每天' : '总共').$item['vote_num']."票"; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
$more = is_more($count, $get['page_no'], $get['page_size']); |
||||
|
$data = [ |
||||
|
'list' => $list, |
||||
|
'page_no' => $get['page_no'], |
||||
|
'page_size' => $get['page_size'], |
||||
|
'count' => $count, |
||||
|
'more' => $more |
||||
|
]; |
||||
|
return $data; |
||||
|
|
||||
|
} catch (\Exception $e) { |
||||
|
return ['error'=>$e->getMessage()]; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Notes: 文章列表 |
||||
|
* @Author: 张无忌 |
||||
|
* @param $get |
||||
|
* @return array |
||||
|
*/ |
||||
|
public static function rank($get) |
||||
|
{ |
||||
|
|
||||
|
$where = [ |
||||
|
['status', '=', 1], |
||||
|
['vote_id',"=",$get['id']] |
||||
|
]; |
||||
|
$order = [ |
||||
|
'vote_num' => 'desc', |
||||
|
'views' => 'desc' |
||||
|
]; |
||||
|
|
||||
|
$model = new VotePlayer(); |
||||
|
|
||||
|
|
||||
|
$list = $model->alias('b') |
||||
|
->where($where) |
||||
|
->order($order) |
||||
|
->limit(50) |
||||
|
->select() |
||||
|
->toArray(); |
||||
|
|
||||
|
$data = [ |
||||
|
'list' => $list |
||||
|
]; |
||||
|
return $data; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Notes: 文章详细 |
||||
|
* @Author: 张无忌 |
||||
|
* @param $id |
||||
|
* @return array |
||||
|
*/ |
||||
|
public static function detail($id,$uid) |
||||
|
{ |
||||
|
$article = Vote::field('*')->where('id', $id)->findOrEmpty(); |
||||
|
$palers = new VotePlayer(); |
||||
|
if($article->isEmpty()) { |
||||
|
$article = []; |
||||
|
}else{ |
||||
|
$article->views = $article->views + 1; |
||||
|
$article->save(); |
||||
|
$article = $article->toArray(); |
||||
|
$article['status_show'] = $article['start_time']<time()?"未开始":($article['end_time']<time() ? "已结束":"进行中" ); |
||||
|
$article['start_time_str'] = $article['start_time']? date("Y-m-d H:i",$article['start_time']):""; |
||||
|
$article['end_time_str'] = $article['end_time']? date("Y-m-d H:i",$article['end_time']):""; |
||||
|
$article['add_time'] = $article['add_time']? date("Y-m-d H:i",$article['add_time']):""; |
||||
|
$article['is_rank'] = $article['is_rank'] ? '显示' : '隐藏'; |
||||
|
$article['is_redo'] = $article['is_redo']==0 ? '当天不可重复' : ($article['is_redo']==1?"全部不重复":"可重复"); |
||||
|
$article['vote_str'] = ($article['vote_type']==0 ? '每天' : '总共').$article['vote_num']."票"; |
||||
|
$article['user_vote_count'] = VoteLogic::getUserPlayerVoteNums($article['id'],$uid,$article['vote_type']); |
||||
|
// 使用正则表达式进行替换 |
||||
|
$pattern = '/<a[^>]+href=["\'](.*?\.(?:mp4|wav))["\'][^>]*>(.*?)<\/a>/i'; |
||||
|
$replacement = '<video src="$1"></video>'; |
||||
|
$article['content'] = preg_replace($pattern, $replacement, $article['content']); |
||||
|
$article['views'] = $article['views'] +$article['base_visit'] ; |
||||
|
// $article['images'] = explode(",",$article['images']); |
||||
|
if($article['images'] ){ |
||||
|
$article['images'] = explode(",",$article['images']); |
||||
|
}else{ |
||||
|
$article['images'] = []; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
$article['player_count'] = $palers->where("vote_id","=",$id)->where("status",'=',1)->where("del","=",0)->count(); |
||||
|
} |
||||
|
|
||||
|
return $article; |
||||
|
} |
||||
|
|
||||
|
public static function players($get,$uid) |
||||
|
{ |
||||
|
$article = Vote::field('*')->where('id', $get['id'])->findOrEmpty(); |
||||
|
|
||||
|
$where = [ |
||||
|
['status', '=', 1], |
||||
|
['vote_id',"=",$get['id']] |
||||
|
]; |
||||
|
if(!empty($get['keyword']) && trim($get['keyword'])){ |
||||
|
$where[] = ['name',"like","%{$get['keyword']}%"]; |
||||
|
} |
||||
|
$order = [ |
||||
|
'add_time' => 'asc' |
||||
|
]; |
||||
|
|
||||
|
$model = new VotePlayer(); |
||||
|
|
||||
|
$count = $model->alias('a')->where($where)->count(); |
||||
|
|
||||
|
$list = $model->alias('b') |
||||
|
->where($where) |
||||
|
->order($order) |
||||
|
->page($get['page_no'], $get['page_size']) |
||||
|
->select() |
||||
|
->toArray(); |
||||
|
foreach ($list as &$item) { |
||||
|
$item['can_vote'] = VoteLogic::getPlayerVoteStatus($article['id'],$item['id'],$uid,$article['is_redo']); |
||||
|
} |
||||
|
|
||||
|
$more = is_more($count, $get['page_no'], $get['page_size']); |
||||
|
$data = [ |
||||
|
'list' => $list, |
||||
|
'page_no' => $get['page_no'], |
||||
|
'page_size' => $get['page_size'], |
||||
|
'count' => $count, |
||||
|
'more' => $more |
||||
|
]; |
||||
|
return $data; |
||||
|
} |
||||
|
|
||||
|
public static function playersDetail($id,$uid) |
||||
|
{ |
||||
|
$article = VotePlayer::field('*')->where('id', $id)->findOrEmpty(); |
||||
|
$vote = Vote::field('*')->where('id', $article['vote_id'])->findOrEmpty(); |
||||
|
$mode = new VotePlayer(); |
||||
|
if($article->isEmpty()) { |
||||
|
$article = []; |
||||
|
}else{ |
||||
|
$article->views = $article->views + 1; |
||||
|
$article->save(); |
||||
|
$article = $article->toArray(); |
||||
|
$article['can_vote'] = VoteLogic::getPlayerVoteStatus($vote['id'],$article['id'],$uid,$vote['is_redo']); |
||||
|
$article['user_vote_count'] = VoteLogic::getUserPlayerVoteNums($vote['id'],$uid,$vote['vote_type']); |
||||
|
$article['title'] = $vote['title']; |
||||
|
$article['start_time'] = $vote['start_time']; |
||||
|
$article['end_time'] = $vote['end_time']; |
||||
|
if($article['images'] ){ |
||||
|
$article['images'] = explode(",",$article['images']); |
||||
|
}else{ |
||||
|
$article['images'] = []; |
||||
|
} |
||||
|
|
||||
|
$article['rank'] = $mode->where('vote_id', $article['vote_id'])->where("vote_num",">",$article['vote_num'])->count() + 1; |
||||
|
if($article['rank']>1){ |
||||
|
$last = $mode->field("*")->where('vote_id', $article['vote_id'])->where("vote_num",">",$article['vote_num'])->order("vote_num","asc")->limit(1)->select(); |
||||
|
$article['rank_last'] = $last[0]['vote_num'] - $article['vote_num']; |
||||
|
}else{ |
||||
|
$article['rank_last'] = 0; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
return $article; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public static function vote($id,$uid) |
||||
|
{ |
||||
|
$article = VotePlayer::field('*')->where('id', $id)->findOrEmpty(); |
||||
|
$vote = Vote::field('*')->where('id', $article['vote_id'])->findOrEmpty(); |
||||
|
if($article->isEmpty() || $vote->isEmpty()) { |
||||
|
return [ |
||||
|
'msg' => '投票成功', |
||||
|
'data' => 1 |
||||
|
]; |
||||
|
} |
||||
|
$can_vote = VoteLogic::getPlayerVoteStatus($vote['id'],$article['id'],$uid,$vote['is_redo']); |
||||
|
$user_count = VoteLogic::getUserPlayerVoteNums($vote['id'],$uid,$vote['vote_type']); |
||||
|
if( !$can_vote ) { |
||||
|
return [ |
||||
|
'msg' => '您已经给TA投过票啦!!', |
||||
|
'data' => 0 |
||||
|
]; |
||||
|
} |
||||
|
|
||||
|
if($vote['vote_num']<=$user_count){ |
||||
|
return [ |
||||
|
'msg' => '您'.($vote['vote_type']==0?'今日':'所有').'的投票数量已达上限!!', |
||||
|
'data' => 0 |
||||
|
]; |
||||
|
} |
||||
|
|
||||
|
$data = [ |
||||
|
"user_id" => $uid, |
||||
|
"vid" => $vote['id'], |
||||
|
"pid" => $article['id'], |
||||
|
"create_time" => time(), |
||||
|
"update_time" => time(), |
||||
|
]; |
||||
|
$voteLog = new VoteLog(); |
||||
|
$res = $voteLog->insert($data); |
||||
|
if($res){ |
||||
|
|
||||
|
//总投票数和选手投票数+1 |
||||
|
$article->vote_num = $article->vote_num + 1; |
||||
|
$article->save(); |
||||
|
|
||||
|
$vote->vote_total = $vote->vote_total + 1; |
||||
|
$vote->save(); |
||||
|
return [ |
||||
|
'msg' => '投票成功', |
||||
|
'data' => 1 |
||||
|
]; |
||||
|
|
||||
|
}else{ |
||||
|
return [ |
||||
|
'msg' => '投票失败', |
||||
|
'data' => 0 |
||||
|
]; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public static function getPlayerVoteStatus($id=0,$player_id=0,$uid=0,$is_redo=0){ |
||||
|
$voteLog = new VoteLog(); |
||||
|
$can_vote = 1; |
||||
|
//当天不重复 统计当天是否给该选手投过票即可 |
||||
|
if($is_redo == 0 ){ |
||||
|
$where = [ |
||||
|
["vid","=",$id], |
||||
|
["pid","=",$player_id], |
||||
|
["user_id","=",$uid], |
||||
|
["create_time",">",strtotime(date("Y-m-d"))] |
||||
|
]; |
||||
|
|
||||
|
$count = $voteLog->where($where)->count(); |
||||
|
if($count){ |
||||
|
$can_vote = 0; |
||||
|
} |
||||
|
}else if($is_redo = 1){ // 全部不重复 则统计活动该用户是否给过选手投票 |
||||
|
$where = [ |
||||
|
["vid","=",$id], |
||||
|
["pid","=",$player_id], |
||||
|
["user_id","=",$uid], |
||||
|
]; |
||||
|
|
||||
|
$count = $voteLog->where($where)->count(); |
||||
|
if($count){ |
||||
|
$can_vote = 0; |
||||
|
} |
||||
|
} |
||||
|
return $can_vote; |
||||
|
} |
||||
|
|
||||
|
public static function getUserPlayerVoteNums($id=0,$uid=0,$vote_type=0){ |
||||
|
$voteLog = new VoteLog(); |
||||
|
$count = 0; |
||||
|
//当天不重复 统计当天是否给该选手投过票即可 |
||||
|
if($vote_type == 0 ){ |
||||
|
$where = [ |
||||
|
["vid","=",$id], |
||||
|
["user_id","=",$uid], |
||||
|
["create_time",">",strtotime(date("Y-m-d"))] |
||||
|
]; |
||||
|
$count = $voteLog->where($where)->count(); |
||||
|
}else if($vote_type = 1){ // 全部不重复 则统计活动该用户是否给过选手投票 |
||||
|
$where = [ |
||||
|
["vid","=",$id], |
||||
|
["user_id","=",$uid], |
||||
|
]; |
||||
|
$count = $voteLog->where($where)->count(); |
||||
|
} |
||||
|
return $count; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
<?php |
||||
|
|
||||
|
|
||||
|
namespace app\common\model\vote; |
||||
|
|
||||
|
|
||||
|
use app\common\basics\Models; |
||||
|
|
||||
|
class Vote extends Models |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
<?php |
||||
|
|
||||
|
|
||||
|
namespace app\common\model\vote; |
||||
|
|
||||
|
|
||||
|
use app\common\basics\Models; |
||||
|
|
||||
|
class VoteLog extends Models |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
<?php |
||||
|
|
||||
|
|
||||
|
namespace app\common\model\vote; |
||||
|
|
||||
|
|
||||
|
use app\common\basics\Models; |
||||
|
|
||||
|
class VotePlayer extends Models |
||||
|
{ |
||||
|
|
||||
|
/** |
||||
|
* @Notes: 关联资源分类模型 |
||||
|
* @Author: |
||||
|
*/ |
||||
|
public function vote() |
||||
|
{ |
||||
|
return $this->hasOne('Vote', 'id', 'vote_id'); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -1,4 +1,4 @@ |
|||||
<?php |
<?php |
||||
//000000000000 |
//000000000000 |
||||
exit();?> |
exit();?> |
||||
a:1:{s:13:"config_server";N;} |
a:1:{s:13:"config_server";i:10;} |
||||
@ -1,4 +1,4 @@ |
|||||
<?php |
<?php |
||||
//000000000000 |
//000000000000 |
||||
exit();?> |
exit();?> |
||||
a:1:{i:0;s:75:"E:\waibao\ahbcqz\server\runtime\cache\c3\c9c276ef335cf7635d9a292d2b5e0f.php";} |
a:3:{i:0;s:75:"E:\waibao\ahbcqz\server\runtime\cache\c3\c9c276ef335cf7635d9a292d2b5e0f.php";i:1;s:75:"E:\waibao\ahbcqz\server\runtime\cache\14\6c96737a90efca9b6c3e57ab3d261f.php";i:2;s:75:"E:\waibao\ahbcqz\server\runtime\cache\4f\788e6bc203331566420281fb43e5e6.php";} |
||||
@ -1,4 +1,4 @@ |
|||||
<?php |
<?php |
||||
//000000000000 |
//000000000000 |
||||
exit();?> |
exit();?> |
||||
a:1:{s:13:"config_server";N;} |
a:1:{s:13:"config_server";s:35:"PCHBZ-UAUKB-QZ2U5-NJVKY-YIXSS-SOF5K";} |
||||
Loading…
Reference in new issue