Merge remote-tracking branch 'origin/main'
|
|
@ -25,7 +25,9 @@ class Article extends NewBaseModel{
|
|||
protected $append = [
|
||||
'category_name'
|
||||
];
|
||||
|
||||
protected $autoWriteTimestamp = 'int'; // 开启自动时间戳
|
||||
protected $createTime = 'create_time'; // 默认添加时间字段
|
||||
protected $updateTime = 'update_time'; // 默认编辑时间字段
|
||||
|
||||
/**
|
||||
* Common: 列表获取
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ use app\model\NewBaseModel;
|
|||
class ArticleCategory extends NewBaseModel{
|
||||
|
||||
protected $pk = 'category_id';
|
||||
protected $autoWriteTimestamp = 'int'; // 开启自动时间戳
|
||||
protected $createTime = 'create_time'; // 默认添加时间字段
|
||||
protected $updateTime = 'update_time'; // 默认编辑时间字段
|
||||
/**
|
||||
* Common: 列表获取
|
||||
* Author: wu-hui
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class ArticleHistory extends NewBaseModel{
|
|||
|
||||
protected $pk = 'id';
|
||||
//protected $autoWriteTimestamp = false; // 开启自动时间戳
|
||||
protected $autoWriteTimestamp = 'int'; // 开启自动时间戳
|
||||
protected $createTime = 'create_time'; // 默认添加时间字段
|
||||
protected $updateTime = 'update_time'; // 默认编辑时间字段
|
||||
protected $deleteTime = false; // 软删除字段
|
||||
|
|
|
|||
|
|
@ -0,0 +1,88 @@
|
|||
<?php
|
||||
/**
|
||||
* SAAS应用系统 --- 十年开发经验汇集巨献!
|
||||
* ==========================================================
|
||||
* Copy right 2020-2050 成都众联思索科技有限公司,保留所有权利。
|
||||
* ----------------------------------------------------------
|
||||
* 官方网址: https://www.zoomtk.com
|
||||
* 这不是自由软件!未经允许不得用于商业目或程序代码摘取及修改。
|
||||
* 任何企业和个人未经允许对程序代码以任何形式任何目的再发布传播。
|
||||
* 唯一发布渠道www.zoomtk.com;非官方渠道统一视为侵权行为。
|
||||
* ==========================================================
|
||||
*/
|
||||
namespace addon\message\api\controller;
|
||||
|
||||
use addon\message\model\Message as messageModel;
|
||||
use addon\message\model\MessageRead;
|
||||
use app\api\controller\BaseApi;
|
||||
|
||||
class Message extends BaseApi{
|
||||
/**
|
||||
* Common: 消息列表
|
||||
* Author: wu-hui
|
||||
* Time: 2023/03/04 16:07
|
||||
* @return false|string
|
||||
*/
|
||||
public function messageList(){
|
||||
// 用户登录
|
||||
$token = $this->checkToken();
|
||||
if ($token['code'] < 0) return $this->response($token);
|
||||
// 参数获取
|
||||
$page = input('page', 1);
|
||||
$page_size = input('page_size', PAGE_LIST_ROWS);
|
||||
$message_type = input('message_type',0);
|
||||
// 获取内容
|
||||
$field = [
|
||||
'a.id',
|
||||
'a.is_see',
|
||||
'a.order_id',
|
||||
'a.created_time',
|
||||
'a.reply_content',
|
||||
'mc.type',
|
||||
'mc.message_title',
|
||||
'mc.message_content',
|
||||
];
|
||||
// 条件生成
|
||||
$condition = [
|
||||
['a.site_id','=',$this->site_id],
|
||||
['a.member_id', '=', $this->member_id ],
|
||||
];
|
||||
if($message_type > 0) $condition[] = ['mc.type', '=', $message_type ];
|
||||
// 表关联
|
||||
$join = [
|
||||
['message_center mc', 'mc.id = a.message_center_id', 'left'],
|
||||
];
|
||||
$list = (new MessageRead())->getPageList($condition, $page, $page_size, 'a.created_time desc,a.id desc', $field, 'a', $join);
|
||||
|
||||
return $this->response($list);
|
||||
}
|
||||
/**
|
||||
* Common: 消息查看
|
||||
* Author: wu-hui
|
||||
* Time: 2023/03/04 16:31
|
||||
*/
|
||||
public function see(){
|
||||
$id = input('id',0);
|
||||
model('message_center_read')->update(['is_see'=>1], ['id'=>$id]);
|
||||
|
||||
return $this->response($this->success());
|
||||
}
|
||||
/**
|
||||
* Common: 留言信息
|
||||
* Author: wu-hui
|
||||
* Time: 2023/03/04 18:04
|
||||
* @return false|string
|
||||
*/
|
||||
public function remarks(){
|
||||
// 用户登录
|
||||
$token = $this->checkToken();
|
||||
if ($token['code'] < 0) return $this->response($token);
|
||||
// 记录留言信息
|
||||
(new messageModel())->addMessage($this->site_id,$this->params['remarks'],4,$this->member_id,0,'',$this->params['image_list']);
|
||||
|
||||
return $this->response($this->success());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -8,19 +8,50 @@ use think\facade\Db;
|
|||
|
||||
class Message extends BaseModel{
|
||||
|
||||
private $types = [
|
||||
1 => '交易信息',
|
||||
2 => '系统消息',
|
||||
3 => '通知消息',
|
||||
4 => '留言反馈',
|
||||
];
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
* @param array $condition
|
||||
* @param int $page
|
||||
* @param int $page_size
|
||||
* @param string $order
|
||||
* @param string $field
|
||||
* @param string $alias
|
||||
* @param array $join
|
||||
* Common: 获取消息列表
|
||||
* Author: wu-hui
|
||||
* Time: 2023/03/04 15:02
|
||||
* @return array
|
||||
* @throws \think\db\exception\DbException
|
||||
*/
|
||||
public function getPageList($condition = [], $page = 1, $page_size = PAGE_LIST_ROWS, $order = '', $field = 'a.*', $alias = 'a', $join = []){
|
||||
$list = model('message_center')->pageList($condition, $field, $order, $page, $page_size, $alias, $join);
|
||||
public function getList($siteId){
|
||||
// 参数获取
|
||||
$page = input('page',1);
|
||||
$pageSize = input('page_size',PAGE_LIST_ROWS);
|
||||
$title = input('title','');
|
||||
$type = input('type','');
|
||||
// 条件生成
|
||||
$where = [
|
||||
['a.site_id','=',$siteId],
|
||||
['a.type','in',[2,3]]
|
||||
];
|
||||
// 其他条件
|
||||
if($title) $where[] = ['a.message_title','like',"%{$title}%"];
|
||||
if($type) $where[] = ['a.type','=',$type];
|
||||
// 列表获取
|
||||
$result = Db::name('message_center')
|
||||
->alias('a')
|
||||
->field('a.id,a.type,a.created_time,a.message_title,count(mcr.message_center_id) as total')
|
||||
->join('message_center_read mcr','mcr.message_center_id = a.id', 'left')
|
||||
->where($where)
|
||||
->group('a.id')
|
||||
->order('a.id','DESC')
|
||||
->paginate(['list_rows' => $pageSize,'page' => $page]);
|
||||
if($result) $result = $result->toArray();
|
||||
|
||||
$list = [
|
||||
'count' => $result['total'],
|
||||
'list' => $result['data'],
|
||||
'page_count' => $result['last_page'],
|
||||
];
|
||||
return $this->success($list);
|
||||
}
|
||||
/**
|
||||
|
|
@ -32,9 +63,10 @@ class Message extends BaseModel{
|
|||
* @param int $type
|
||||
* @param string|int $member_id
|
||||
* @param int $orderId
|
||||
* @param string $title
|
||||
* @return array
|
||||
*/
|
||||
public function addMessage(int $siteId,string $content,int $type,$member_id = 'all',int $orderId = 0){
|
||||
public function addMessage(int $siteId,string $content,int $type,$member_id = 'all',int $orderId = 0,$title = '',$image = ''){
|
||||
if(!$content) return $this->error('','消息不能为空!');
|
||||
// 记录消息信息
|
||||
try{
|
||||
|
|
@ -42,8 +74,10 @@ class Message extends BaseModel{
|
|||
->insertGetId([
|
||||
'site_id' => $siteId,
|
||||
'type' => $type,
|
||||
'message_title' => $title ?? $this->types[$type],
|
||||
'message_content' => $content,
|
||||
'created_time' => time()
|
||||
'created_time' => time(),
|
||||
'image_list' => $image,
|
||||
]);
|
||||
// 关联用户信息
|
||||
if($member_id == 'all'){
|
||||
|
|
@ -76,6 +110,84 @@ class Message extends BaseModel{
|
|||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Common: 删除消息
|
||||
* Author: wu-hui
|
||||
* Time: 2023/03/04 15:48
|
||||
* @param $id
|
||||
* @return array
|
||||
*/
|
||||
public function delInfo($id){
|
||||
// 删除消息信息
|
||||
Model('message_center')->delete(['id'=>$id]);
|
||||
Model('message_center_read')->delete(['message_center_id'=>$id]);
|
||||
|
||||
return $this->success();
|
||||
}
|
||||
/**
|
||||
* Common: 获取留言信息
|
||||
* Author: wu-hui
|
||||
* Time: 2023/03/04 18:07
|
||||
* @param $siteId
|
||||
* @return array
|
||||
* @throws \think\db\exception\DbException
|
||||
*/
|
||||
public function getRemarks($siteId){
|
||||
// 参数获取
|
||||
$page = input('page',1);
|
||||
$pageSize = input('page_size',PAGE_LIST_ROWS);
|
||||
$nickname = input('nickname','');
|
||||
$type = (int)input('type',0);
|
||||
// 条件生成
|
||||
$where = [
|
||||
['a.site_id','=',$siteId],
|
||||
['a.type','=',4]
|
||||
];
|
||||
if($nickname) $where[] = ['m.username|m.nickname','like',"%{$nickname}%"];
|
||||
if($type > 0) $where[] = ['mcr.is_see','=',$type == 1 ? 0 : 1];// 是否已读:0=未读,1=已读
|
||||
// 列表获取
|
||||
$result = Db::name('message_center')
|
||||
->alias('a')
|
||||
->field('a.id,a.type,a.created_time,mcr.member_id,mcr.is_see,m.username,m.nickname,m.headimg')
|
||||
->join('message_center_read mcr','mcr.message_center_id = a.id', 'left')
|
||||
->join('member m','m.member_id = mcr.member_id','left')
|
||||
->where($where)
|
||||
->group('a.id')
|
||||
->order('a.id','DESC')
|
||||
->paginate(['list_rows' => $pageSize,'page' => $page]);
|
||||
if($result) $result = $result->toArray();
|
||||
|
||||
$list = [
|
||||
'count' => $result['total'],
|
||||
'list' => $result['data'],
|
||||
'page_count' => $result['last_page'],
|
||||
];
|
||||
return $this->success($list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Common: 获取单条信息
|
||||
* Author: wu-hui
|
||||
* Time: 2023/03/06 9:38
|
||||
* @param array $where
|
||||
* @param string $field
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getInfo($where = [], $field = '*'){
|
||||
$result = Db::name('message_center')
|
||||
->alias('a')
|
||||
->field($field)
|
||||
->join('message_center_read mcr','mcr.message_center_id = a.id', 'left')
|
||||
->join('member m','m.member_id = mcr.member_id','left')
|
||||
->where($where)
|
||||
->find();
|
||||
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace addon\message\model;
|
||||
|
||||
use app\model\BaseModel;
|
||||
|
||||
class MessageRead extends BaseModel{
|
||||
/**
|
||||
* 获取列表
|
||||
* @param array $condition
|
||||
* @param int $page
|
||||
* @param int $page_size
|
||||
* @param string $order
|
||||
* @param string $field
|
||||
* @param string $alias
|
||||
* @param array $join
|
||||
* @return array
|
||||
*/
|
||||
public function getPageList($condition = [], $page = 1, $page_size = PAGE_LIST_ROWS, $order = '', $field = 'a.*', $alias = 'a', $join = [])
|
||||
{
|
||||
$list = model('message_center_read')->pageList($condition, $field, $order, $page, $page_size, $alias, $join);
|
||||
return $this->success($list);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -17,47 +17,15 @@ use addon\message\model\Message as messageModel;
|
|||
use think\facade\Db;
|
||||
|
||||
class Message extends BaseShop{
|
||||
// 进入消息中心
|
||||
/**
|
||||
* Common: 进入消息中心
|
||||
* Author: wu-hui
|
||||
* Time: 2023/03/04 15:03
|
||||
* @return array|mixed
|
||||
* @throws \think\db\exception\DbException
|
||||
*/
|
||||
public function index(){
|
||||
if(request()->isAjax()){
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
debug(table('message_center_read'));
|
||||
// 参数获取
|
||||
$page = input('page',1);
|
||||
$pageSize = input('page_size',PAGE_LIST_ROWS);
|
||||
// 获取内容
|
||||
$field = [
|
||||
'a.id',
|
||||
'a.type',
|
||||
'a.created_time',
|
||||
'count(a.id) as total',
|
||||
'(select count(id) from )',
|
||||
|
||||
];
|
||||
// 表关联
|
||||
$join = [
|
||||
['message_center_read mcr', 'mcr.message_center_id = a.id', 'left'],
|
||||
];
|
||||
// 条件生成
|
||||
$condition = [
|
||||
['a.site_id','=',$this->site_id]
|
||||
];
|
||||
$res = (new messageModel())->getPageList($condition, $page, $pageSize, 'a.created_time desc,a.id desc', $field, 'a', $join);
|
||||
|
||||
debug($res);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(request()->isAjax()) return (new messageModel())->getList($this->site_id);
|
||||
|
||||
$this->forthMenu();
|
||||
return $this->fetch('message/index');
|
||||
|
|
@ -73,11 +41,23 @@ class Message extends BaseShop{
|
|||
// 参数获取
|
||||
$type = input('type',2);
|
||||
$content = input('message_content','');
|
||||
$title = input('title','');
|
||||
|
||||
return (new messageModel())->addMessage($this->site_id,$content,$type);
|
||||
return (new messageModel())->addMessage($this->site_id,$content,$type,'all',0,$title);
|
||||
}
|
||||
|
||||
return $this->fetch('message/send_message');
|
||||
}
|
||||
/**
|
||||
* Common: 删除信息
|
||||
* Author: wu-hui
|
||||
* Time: 2023/03/04 15:48
|
||||
* @return array
|
||||
*/
|
||||
public function delMessage(){
|
||||
$id = input('id');
|
||||
|
||||
return (new messageModel())->delInfo($id);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
/**
|
||||
* SAAS应用系统 --- 十年开发经验汇集巨献!
|
||||
* ==========================================================
|
||||
* Copy right 2020-2050 成都众联思索科技有限公司,保留所有权利。
|
||||
* ----------------------------------------------------------
|
||||
* 官方网址: https://www.zoomtk.com
|
||||
* 这不是自由软件!未经允许不得用于商业目或程序代码摘取及修改。
|
||||
* 任何企业和个人未经允许对程序代码以任何形式任何目的再发布传播。
|
||||
* 唯一发布渠道www.zoomtk.com;非官方渠道统一视为侵权行为。
|
||||
* ==========================================================
|
||||
*/
|
||||
namespace addon\message\shop\controller;
|
||||
|
||||
use app\shop\controller\BaseShop;
|
||||
use addon\message\model\Message as messageModel;
|
||||
|
||||
class Remark extends BaseShop{
|
||||
/**
|
||||
* Common: 进入留言管理
|
||||
* Author: wu-hui
|
||||
* Time: 2023/03/06 9:12
|
||||
* @return array|mixed
|
||||
* @throws \think\db\exception\DbException
|
||||
*/
|
||||
public function index(){
|
||||
if(request()->isAjax()) return (new messageModel())->getRemarks($this->site_id);
|
||||
|
||||
$this->forthMenu();
|
||||
return $this->fetch('remark/index');
|
||||
}
|
||||
/**
|
||||
* Common: 查看详情&回复内容
|
||||
* Author: wu-hui
|
||||
* Time: 2023/03/06 10:09
|
||||
* @return array|mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function seeInfo(){
|
||||
// 获取基本信息
|
||||
$messageCenterId = input('message_center_id');
|
||||
Model('message_center_read')->update(['is_see'=>1],['message_center_id'=>$messageCenterId]);
|
||||
if(request()->isAjax()) {
|
||||
// 回复内容
|
||||
$replyContent = input('reply_content');
|
||||
Model('message_center_read')->update(['reply_content'=>$replyContent],['message_center_id'=>$messageCenterId]);
|
||||
|
||||
return success();
|
||||
}
|
||||
// 获取信息
|
||||
$where = [
|
||||
['a.id','=',$messageCenterId]
|
||||
];
|
||||
$field = 'a.id,a.created_time,a.message_content,a.image_list,mcr.is_see,m.username,m.nickname,m.headimg';
|
||||
$info = (new messageModel())->getInfo($where,$field)['data'];
|
||||
$info['image_list'] = $info['image_list'] ? explode(',',$info['image_list']) : [];
|
||||
$this->assign('info',$info);
|
||||
$this->assign('message_center_id',$messageCenterId);
|
||||
|
||||
return $this->fetch('remark/see');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -5,7 +5,6 @@
|
|||
background-color: #009688;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
</style>
|
||||
{/block}
|
||||
|
||||
|
|
@ -16,51 +15,22 @@
|
|||
<div class="layui-colla-content layui-form layui-show" lay-filter="search_form">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">用户昵称:</label>
|
||||
<label class="layui-form-label">消息标题:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="nickname" placeholder="用户昵称" autocomplete="off" class="layui-input"/>
|
||||
<input type="text" name="title" placeholder="消息标题" autocomplete="off" class="layui-input"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">交易状态:</label>
|
||||
<label class="layui-form-label">消息类型:</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="status" lay-filter="is_settlement">
|
||||
<select name="type">
|
||||
<option value="">全部</option>
|
||||
<option value="1">库存</option>
|
||||
<option value="2">已上架</option>
|
||||
<option value="3">已售出</option>
|
||||
<option value="4">提货中</option>
|
||||
<option value="5">提货完成</option>
|
||||
<option value="6">待支付</option>
|
||||
<option value="7">捡漏</option>
|
||||
<option value="2">系统消息</option>
|
||||
<option value="3">通知消息</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">交易时间:</label>
|
||||
<!--交易时间类型-->
|
||||
<div class="layui-input-inline">
|
||||
<select name="time_type" lay-filter="is_settlement">
|
||||
<option value="created">购买时间</option>
|
||||
<option value="release">上架时间</option>
|
||||
<option value="sell">售卖时间</option>
|
||||
<option value="take">取货时间</option>
|
||||
</select>
|
||||
</div>
|
||||
<!--时间选择-->
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" class="layui-input" name="start_time" placeholder="开始时间" id="start_time" readonly>
|
||||
<i class=" iconrili iconfont calendar"></i>
|
||||
</div>
|
||||
<div class="layui-form-mid">-</div>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" class="layui-input" name="end_time" placeholder="结束时间" id="end_time" readonly>
|
||||
<i class=" iconrili iconfont calendar"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<button class="layui-btn publish-btn" lay-submit lay-filter="publish">发布</button>
|
||||
<button class="layui-btn" lay-submit lay-filter="search">筛选</button>
|
||||
|
|
@ -74,97 +44,43 @@
|
|||
<!-- 操作 -->
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn">
|
||||
<a class="layui-btn" lay-event="seeDetail">查看详情</a>
|
||||
</div>
|
||||
</script>
|
||||
<!--会员信息-->
|
||||
<script type="text/html" id="memberInfo">
|
||||
<div class='table-title'>
|
||||
<div class='title-pic'>
|
||||
<img layer-src src="{{ns.img(d.seller_headimg)}}" onerror="this.src = '{:img(\'public/static/img/default_img/head.png\')}' ">
|
||||
</div>
|
||||
<div class='title-content'>
|
||||
{{# if(d.seller_username){ }}
|
||||
<p class="layui-elip">{{d.seller_username}}</p>
|
||||
{{# } else { }}
|
||||
<p class="layui-elip">{{d.seller_nickname}}</p>
|
||||
{{# } }}
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<!--商品信息-->
|
||||
<script type="text/html" id="goodsInfo">
|
||||
<div class='table-title' title="{{d.goods_name}}">
|
||||
<div class='title-pic'>
|
||||
<img layer-src src="{{ns.img(d.goods_image)}}" onerror="this.src = '{:img(\'public/static/img/default_img/head.png\')}' ">
|
||||
</div>
|
||||
<div class='title-content'>
|
||||
<p class="layui-elip">{{d.goods_name}}</p>
|
||||
</div>
|
||||
<a class="layui-btn" lay-event="deleteInfo">删除</a>
|
||||
</div>
|
||||
</script>
|
||||
{/block}
|
||||
|
||||
{block name="script"}
|
||||
<script>
|
||||
var table, form, editIframe,laydate, repeat_flag = false;//防重复标识;
|
||||
layui.use(['form','laydate'], function() {
|
||||
var table, form, editIframe, repeat_flag = false;//防重复标识;
|
||||
layui.use(['form'], function() {
|
||||
form = layui.form;
|
||||
laydate = layui.laydate;
|
||||
form.render();
|
||||
//渲染时间
|
||||
laydate.render({
|
||||
elem: '#start_time'
|
||||
,type: 'datetime'
|
||||
,change: function(value, date, endDate){
|
||||
$(".date-picker-btn").removeClass("selected");
|
||||
}
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#end_time'
|
||||
,type: 'datetime'
|
||||
,change: function(value, date, endDate){
|
||||
$(".date-picker-btn").removeClass("selected");
|
||||
}
|
||||
});
|
||||
// 内容获取
|
||||
table = new Table({
|
||||
elem: '#listContent',
|
||||
url: ns.url("futures://shop/futures/index"),
|
||||
url: ns.url("message://shop/message/index"),
|
||||
cols: [[
|
||||
{align: 'center', field: 'id', title: 'ID', width: '5%', unresize: 'false'},
|
||||
{align: 'left', title: '买家信息', unresize: 'area',width: '15%', templet: '#memberInfo'},
|
||||
{align: 'left', title: '商品信息', unresize: 'area',width: '15%', templet: '#goodsInfo'},
|
||||
{align: 'center', title: '商品数量', field: 'total',width: '10%', unresize: 'area'},
|
||||
{align: 'center', title: '购买价格', field: 'unit_price',width: '10%', unresize: 'area'},
|
||||
{align: 'center', title: '消息标题', field:'message_title', unresize: 'area'},
|
||||
{align: 'center', title: '接收人数', field: 'total',unresize: 'area'},
|
||||
{
|
||||
align: 'center',width: '10%', templet: function (d) {
|
||||
// 状态(1=库存,2=已上架,3=已售出,4=提货中,5=提货完成,6=待支付,7=捡漏)
|
||||
align: 'center',templet: function (d) {
|
||||
// 消息类型:1=交易信息,2=系统消息,3=通知消息,4=留言反馈
|
||||
let statusText = '';
|
||||
switch (parseInt(d.status)) {
|
||||
case 1: statusText = '<p>库存</p>'; break;
|
||||
case 2: statusText = '<p style="color: #07c160;">已上架</p>'; break;
|
||||
case 3: statusText = '<p style="color: #1989fa;">已售出</p>'; break;
|
||||
case 4: statusText = '<p style="color: #7232dd;">提货中</p>'; break;
|
||||
case 5: statusText = '<p style="color: #ad0000;">提货完成</p>'; break;
|
||||
case 6: statusText = '<p style="color: #ff976a;">待支付</p>'; break;
|
||||
case 7: statusText = '<p style="color: #ee0a24;">捡漏</p>'; break;
|
||||
switch (parseInt(d.type)) {
|
||||
case 1: statusText = '<p style="color: #07c160;">交易信息</p>'; break;
|
||||
case 2: statusText = '<p style="color: #1989fa;">系统消息</p>'; break;
|
||||
case 3: statusText = '<p style="color: #7232dd;">通知消息</p>'; break;
|
||||
case 4: statusText = '<p style="color: #ad0000;">留言反馈</p>'; break;
|
||||
}
|
||||
|
||||
return statusText;
|
||||
}, title: '交易状态', unresize: 'false'
|
||||
},
|
||||
{
|
||||
align: 'center',width: '15%', templet: function (d) {
|
||||
let timeText = '';
|
||||
if(d.release_time > 0) timeText += '<p class="time_p">上架时间:'+ns.time_to_date(d.release_time,'YYYY-MM-DD h:m')+'</p>';
|
||||
if(d.sell_time > 0) timeText += '<p class="time_p">售卖时间:'+ns.time_to_date(d.sell_time,'YYYY-MM-DD h:m')+'</p>';
|
||||
if(d.created_time > 0) timeText += '<p class="time_p">购买时间:'+ns.time_to_date(d.created_time,'YYYY-MM-DD h:m')+'</p>';
|
||||
if(d.take_time > 0) timeText += '<p class="time_p">取货时间:'+ns.time_to_date(d.take_time,'YYYY-MM-DD h:m')+'</p>';
|
||||
|
||||
return timeText;
|
||||
}, title: '交易时间', unresize: 'false'
|
||||
}, title: '消息类型', unresize: 'false'
|
||||
},
|
||||
{align: 'center', title: '发布时间', field: 'created_time',unresize: 'area',
|
||||
templet: function(data) {
|
||||
return ns.time_to_date(data.created_time);
|
||||
}},
|
||||
{title: '操作', toolbar: '#operation', unresize: 'false', align: 'right'}
|
||||
]],
|
||||
});
|
||||
|
|
@ -194,11 +110,8 @@
|
|||
// 重置表单
|
||||
form.on('submit(reset)', function(data) {
|
||||
let field = {
|
||||
"nickname": "",
|
||||
"status": "",
|
||||
"time_type": "created",
|
||||
"start_time": "",
|
||||
"end_time": "",
|
||||
"title": "",
|
||||
"type": "",
|
||||
};
|
||||
form.val("search_form", field);
|
||||
layui.form.render();
|
||||
|
|
@ -216,17 +129,27 @@
|
|||
eval(obj.event)(data)
|
||||
});
|
||||
});
|
||||
// 点击查看详情
|
||||
function seeDetail(data){
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '交易详情',
|
||||
skin: 'layer-tips-class',
|
||||
area: ['80%','90%'],
|
||||
content: ns.url("futures://shop/futures/seeDetail", { id: data.id }),
|
||||
end: function(){
|
||||
//table.reload();
|
||||
}
|
||||
// 删除消息
|
||||
function deleteInfo(data){
|
||||
layer.confirm('确认删除当前消息?删除后所有已发送给用户当前消息将同步删除。', {icon: 3, title:'提示'}, function(index){
|
||||
layer.close(index);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: ns.url("message://shop/message/delMessage"),
|
||||
data: { id: data.id },
|
||||
async: false,
|
||||
success: function(res){
|
||||
if (res.code == 0) {
|
||||
layer.alert('删除成功', function(index){
|
||||
layer.close(index);
|
||||
table.reload();
|
||||
});
|
||||
}else{
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -61,6 +61,12 @@
|
|||
|
||||
{block name="body"}
|
||||
<div class="layui-form form-wrap" lay-filter="formInfo">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label img-upload-lable short-label"><span class="required">*</span>消息标题:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="title" autocomplete="off" class="layui-input" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label img-upload-lable short-label">消息类型:</label>
|
||||
<div class="layui-input-inline">
|
||||
|
|
@ -101,11 +107,13 @@
|
|||
layer.msg('请输入消息内容!');
|
||||
return false;
|
||||
}
|
||||
if(!field['title']){
|
||||
layer.msg('请输入消息标题!');
|
||||
return false;
|
||||
}
|
||||
// 数据提交
|
||||
layer.confirm('确认发布当前消息给所有用户?', {icon: 3, title:'提示'}, function(index){
|
||||
layer.close(index);
|
||||
if(repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
|
|
@ -113,7 +121,6 @@
|
|||
data: field,
|
||||
async: false,
|
||||
success: function(res){
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
layer.alert('发布成功', function(index){
|
||||
parent.layer.close(_thisIndex);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,160 @@
|
|||
{extend name="app/shop/view/base.html"/}
|
||||
{block name="resources"}
|
||||
<style>
|
||||
.publish-btn{
|
||||
background-color: #009688;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
{/block}
|
||||
|
||||
{block name="main"}
|
||||
<!-- 筛选面板 -->
|
||||
<div class="screen layui-collapse" lay-filter="selection_panel">
|
||||
<div class="layui-colla-item">
|
||||
<div class="layui-colla-content layui-form layui-show" lay-filter="search_form">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">用户昵称:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="nickname" placeholder="用户昵称" autocomplete="off" class="layui-input"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">是否已读:</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="type">
|
||||
<option value="">全部</option>
|
||||
<option value="1">未读</option>
|
||||
<option value="2">已读</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="search">筛选</button>
|
||||
<button type="reset" lay-submit lay-filter="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 列表 -->
|
||||
<table id="listContent" lay-filter="listContent"></table>
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn">
|
||||
<a class="layui-btn" lay-event="seeInfo">查看</a>
|
||||
</div>
|
||||
</script>
|
||||
<!--会员信息-->
|
||||
<script type="text/html" id="memberInfo">
|
||||
<div class='table-title'>
|
||||
<div class='title-pic'>
|
||||
<img layer-src src="{{ns.img(d.headimg)}}" onerror="this.src = '{:img(\'public/static/img/default_img/head.png\')}' ">
|
||||
</div>
|
||||
<div class='title-content'>
|
||||
{{# if(d.username){ }}
|
||||
<p class="layui-elip">{{d.username}}</p>
|
||||
{{# } else { }}
|
||||
<p class="layui-elip">{{d.nickname}}</p>
|
||||
{{# } }}
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
{/block}
|
||||
|
||||
{block name="script"}
|
||||
<script>
|
||||
var table, form, editIframe,laydate, repeat_flag = false;//防重复标识;
|
||||
layui.use(['form','laydate'], function() {
|
||||
form = layui.form;
|
||||
laydate = layui.laydate;
|
||||
form.render();
|
||||
//渲染时间
|
||||
laydate.render({
|
||||
elem: '#start_time'
|
||||
,type: 'datetime'
|
||||
,change: function(value, date, endDate){
|
||||
$(".date-picker-btn").removeClass("selected");
|
||||
}
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#end_time'
|
||||
,type: 'datetime'
|
||||
,change: function(value, date, endDate){
|
||||
$(".date-picker-btn").removeClass("selected");
|
||||
}
|
||||
});
|
||||
// 内容获取
|
||||
table = new Table({
|
||||
elem: '#listContent',
|
||||
url: ns.url("message://shop/remark/index"),
|
||||
cols: [[
|
||||
{align: 'center', field: 'id', title: 'ID', width: '5%', unresize: 'false'},
|
||||
{align: 'left', title: '留言用户', unresize: 'area',templet: '#memberInfo'},
|
||||
{
|
||||
align: 'center', templet: function (d) {
|
||||
// 是否已读:0=未读,1=已读
|
||||
let statusText = '';
|
||||
switch (parseInt(d.is_see)) {
|
||||
case 0: statusText = '<p style="color: #1989fa;">未读</p>'; break;
|
||||
case 1: statusText = '<p>已读</p>'; break;
|
||||
}
|
||||
return statusText;
|
||||
}, title: '是否已读', unresize: 'false'
|
||||
},
|
||||
{align: 'center', title: '留言时间', field: 'created_time',unresize: 'area',
|
||||
templet: function(data) {
|
||||
return ns.time_to_date(data.created_time);
|
||||
}},
|
||||
{title: '操作', toolbar: '#operation', unresize: 'false', align: 'right'}
|
||||
]],
|
||||
});
|
||||
// 点击搜索
|
||||
form.on('submit(search)', function(data) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
});
|
||||
return false;
|
||||
});
|
||||
// 重置表单
|
||||
form.on('submit(reset)', function(data) {
|
||||
let field = {
|
||||
"nickname": "",
|
||||
"type": "",
|
||||
};
|
||||
form.val("search_form", field);
|
||||
layui.form.render();
|
||||
// 刷新表格
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: field
|
||||
});
|
||||
});
|
||||
// 监听工具栏操作
|
||||
table.tool(function(obj) {
|
||||
var data = obj.data;
|
||||
eval(obj.event)(data)
|
||||
});
|
||||
});
|
||||
// 查看信息详情
|
||||
function seeInfo(data){
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '消息发布',
|
||||
skin: 'layer-tips-class',
|
||||
area: ['80%','90%'],
|
||||
content: ns.url("message://shop/remark/seeInfo",{ message_center_id: data.id }),
|
||||
end: function(){
|
||||
table.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
{/block}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
{extend name="app/shop/view/base.html"/}
|
||||
{block name="resources"}
|
||||
<style>
|
||||
.tips{
|
||||
font-size: 13px;
|
||||
color: #cccccc;
|
||||
}
|
||||
.hide{
|
||||
display: none;
|
||||
}
|
||||
.avatar{
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.nickname{
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
}
|
||||
.image-list-item{
|
||||
max-width: 150px;
|
||||
height: 150px;
|
||||
}
|
||||
</style>
|
||||
{/block}
|
||||
|
||||
{block name="body"}
|
||||
<div class="layui-form form-wrap" lay-filter="formInfo">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label img-upload-lable short-label">用户信息:</label>
|
||||
<div class="layui-input-inline">
|
||||
<img class="avatar" src="{:img($info['headimg'])}" onerror="this.src = '{:img(\'public/static/img/default_img/head.png\')}'">
|
||||
<div class="nickname">{$info['nickname'] ?? $info['username']}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label img-upload-lable short-label">提交时间:</label>
|
||||
<div class="layui-input-inline">
|
||||
{:date('Y-m-d H:i:s',$info['created_time'])}
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label img-upload-lable short-label">消息内容:</label>
|
||||
<div class="layui-input-inline">
|
||||
<textarea class="layui-textarea len-long" rows="10" disabled>{$info['message_content']}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label img-upload-lable short-label">相关图片:</label>
|
||||
<div class="layui-input-inline">
|
||||
{foreach $info['image_list'] as $img}
|
||||
<img class="image-list-item" layer-src src="{:img($img)}" onerror="this.src = '{:img(\'public/static/img/default_img/head.png\')}'"/>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label img-upload-lable short-label">回复内容:</label>
|
||||
<div class="layui-input-inline">
|
||||
<textarea name="reply_content" class="layui-textarea len-long" rows="10">{$info['reply_content'] ?? ''}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<!--提交按钮-->
|
||||
<div class="form-row">
|
||||
<input type="text" value="{$message_center_id}" name="message_center_id" autocomplete="off" class="layui-input hide"/>
|
||||
<button class="layui-btn" lay-submit lay-filter="save">提交回复</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="closeIframe()">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
{block name="script"}
|
||||
<script>
|
||||
var _thisIndex,form,repeat_flag = false,goods_info = {};
|
||||
$(function () {
|
||||
// 基本参数
|
||||
_thisIndex = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
|
||||
// 表单内容
|
||||
layui.use(['form'], function() {
|
||||
form = layui.form;
|
||||
form.render();
|
||||
// 表单提交
|
||||
form.on('submit(save)', function(data){
|
||||
var field = data.field;
|
||||
// 判断信息是否完整
|
||||
if(!field['reply_content']){
|
||||
layer.msg('请输入回复内容!');
|
||||
return false;
|
||||
}
|
||||
// 数据提交
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: ns.url("message://shop/remark/seeInfo"),
|
||||
data: field,
|
||||
async: false,
|
||||
success: function(res){
|
||||
if (parseInt(res.code) === 0) {
|
||||
layer.msg(res.message);
|
||||
parent.layer.close(_thisIndex);
|
||||
}else{
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
// 点击关闭弹框
|
||||
function closeIframe() {
|
||||
parent.layer.close(_thisIndex); //再执行关闭
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
|
|
@ -180,6 +180,6 @@ class Wechat extends BaseApi
|
|||
$config_model = new ConfigModel();
|
||||
$config_result = $config_model->getWechatConfig($this->site_id)[ 'data' ][ 'value' ];
|
||||
|
||||
return $this->response($this->success([ 'qrcode' => $config_result[ 'qrcode' ] ]));
|
||||
return $this->response($this->success([ 'qrcode' => $config_result[ 'qrcode' ] ?? '' ]));
|
||||
}
|
||||
}
|
||||
|
|
@ -1830,3 +1830,72 @@ function decode($code)
|
|||
}
|
||||
return $num;
|
||||
}
|
||||
|
||||
/**
|
||||
* Common: 下划线字符串 转 驼峰字符串
|
||||
* Author: wu-hui
|
||||
* Time: 2022/10/20 16:25
|
||||
* @param $string
|
||||
* @param string $separator
|
||||
* @return string
|
||||
*/
|
||||
function camelize($string,$separator = '_'){
|
||||
$string = $separator. str_replace($separator, " ", strtolower($string));
|
||||
return ltrim(str_replace(" ", "", ucwords($string)), $separator );
|
||||
}
|
||||
/**
|
||||
* Common: 根据类型获取对应的时间戳
|
||||
* Author: wu-hui
|
||||
* Time: 2022/11/01 17:20
|
||||
* @param $type
|
||||
* @return array
|
||||
*/
|
||||
function getTimeStamp($type){
|
||||
$startTime = $endTime =0;
|
||||
#year=本年,month=本月,today=今日,yesterday=昨日,last_week=上周,
|
||||
switch($type){
|
||||
// 本年
|
||||
case "year":
|
||||
$startTime = strtotime(date("Y-1-1"));
|
||||
$endTime = strtotime(date("Y-1-1"). " +1 year -1 day ");
|
||||
break;
|
||||
// 本月
|
||||
case "month":
|
||||
$startTime = strtotime(date("Y-m-1"));
|
||||
$endTime = strtotime(date("Y-m-1"). " +1 month -1 day ");
|
||||
break;
|
||||
// 今日
|
||||
case "today":
|
||||
$startTime = strtotime(date("Y-m-d"));
|
||||
$endTime = strtotime(date("Y-m-d"). " +1 day ");
|
||||
break;
|
||||
// 昨日
|
||||
case "yesterday":
|
||||
$startTime = strtotime(date("Y-m-d"). " -1 day ");
|
||||
$endTime = strtotime(date("Y-m-d"));
|
||||
break;
|
||||
// 上周
|
||||
case "last_week":
|
||||
$week = date('w') == 0 ? 7 : date('w');
|
||||
$startTime = strtotime('today -' . ($week - 1) . 'day -1 week');
|
||||
$endTime = strtotime('today +' . (8 - $week) . 'day -1 week');
|
||||
break;
|
||||
|
||||
}
|
||||
return [$startTime,$endTime];
|
||||
}
|
||||
/**
|
||||
* Common: 字符串脱敏处理
|
||||
* Author: wu-hui
|
||||
* Time: 2022/11/03 10:48
|
||||
* @param string $str 字符串内容
|
||||
* @param int $front 前面保留数字字数
|
||||
* @param int $after 后面保留数字字数
|
||||
* @return string
|
||||
*/
|
||||
function desensitizationHandle($str,$front,$after){
|
||||
$frontStr = mb_substr($str,0,$front);
|
||||
$afterStr = mb_substr($str,-$after,$after);
|
||||
|
||||
return $frontStr.'***'.$afterStr;
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
/** ZJMall商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2022-2032 四川正今科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.zjphp.com
|
||||
* 这不是自由软件!未经允许不得用于商业目或程序代码摘取及修改。
|
||||
* 任何企业和个人不允许对程序代码以任何形式任何目的再发布传播。
|
||||
* 唯一发布渠道官方颁发授权证书,无纸质授权凭证书视为侵权行为。
|
||||
* =========================================================
|
||||
*/
|
||||
namespace app\shop\controller;
|
||||
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
|
||||
|
||||
class NewBaseShop extends BaseShop{
|
||||
|
||||
protected $thisDefaultModel = '';// 当前控制器默认的模型 为空则不存在
|
||||
|
||||
|
||||
/**
|
||||
* Common: 公共内容 —— 列表获取
|
||||
* Author: wu-hui
|
||||
* Time: 2022/10/18 14:05
|
||||
*/
|
||||
public function index(){
|
||||
return $this->thisDefaultModel->getList($this->site_id);
|
||||
}
|
||||
/**
|
||||
* Common: 公共内容 —— 添加/编辑信息
|
||||
* Author: wu-hui
|
||||
* Time: 2022/10/18 14:09
|
||||
*/
|
||||
public function editInfo(){
|
||||
if (request()->isAjax()) {
|
||||
// 参数获取
|
||||
$info = input('info',[]);
|
||||
$info['site_id'] = $this->site_id;
|
||||
|
||||
return $this->thisDefaultModel->editInfo($info);
|
||||
} else {
|
||||
// 获取id
|
||||
$id = input('id',0);
|
||||
$this->assign('id',$id);
|
||||
// 获取信息
|
||||
if($id > 0){
|
||||
$info = $this->thisDefaultModel->singleInfo($id);
|
||||
$this->assign('info',$info['data'] ?? []);
|
||||
}else{
|
||||
$this->assign('info',[]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Common: 删除单条信息
|
||||
* Author: wu-hui
|
||||
* Time: 2022/10/18 14:13
|
||||
*/
|
||||
public function delete(){
|
||||
$id = input('id', 0);
|
||||
|
||||
return $this->thisDefaultModel->delInfo($id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
After Width: | Height: | Size: 250 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 6.3 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 98 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 3.2 KiB |