mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2026-06-30 19:17:43 +08:00
批量上下架
This commit is contained in:
@ -199,13 +199,12 @@ class AlipayLifeMenuController extends CommonController
|
||||
|
||||
// 参数
|
||||
$this->assign('params', array_merge($_POST, $_GET));
|
||||
$this->assign('msg_type', I('msg_type', 0));
|
||||
$this->display('SaveInfo');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [Index 消息内容列表]
|
||||
* [Index 内容列表]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
@ -230,8 +229,8 @@ class AlipayLifeMenuController extends CommonController
|
||||
}
|
||||
|
||||
// 主数据
|
||||
$menu = empty($_REQUEST['menu_id']) ? array() : M('AlipayLifeMenu')->find(I('menu_id'));
|
||||
$this->assign('menu', $menu);
|
||||
$data = empty($_REQUEST['menu_id']) ? array() : M('AlipayLifeMenu')->find(I('menu_id'));
|
||||
$this->assign('data', $data);
|
||||
|
||||
// 参数
|
||||
$this->assign('params', $params);
|
||||
@ -243,7 +242,7 @@ class AlipayLifeMenuController extends CommonController
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息内容处理
|
||||
* 内容处理
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
@ -303,7 +302,7 @@ class AlipayLifeMenuController extends CommonController
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息详情
|
||||
* 详情
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
|
||||
313
service/Application/Admin/Controller/AlipayLifeStatusController.class.php
Executable file
313
service/Application/Admin/Controller/AlipayLifeStatusController.class.php
Executable file
@ -0,0 +1,313 @@
|
||||
<?php
|
||||
|
||||
namespace Admin\Controller;
|
||||
|
||||
use Service\AlipayLifeService;
|
||||
|
||||
/**
|
||||
* 生活号批量上下架管理
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-01T21:51:08+0800
|
||||
*/
|
||||
class AlipayLifeStatusController extends CommonController
|
||||
{
|
||||
/**
|
||||
* [_initialize 前置操作-继承公共前置方法]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-03T12:39:08+0800
|
||||
*/
|
||||
public function _initialize()
|
||||
{
|
||||
// 调用父类前置方法
|
||||
parent::_initialize();
|
||||
|
||||
// 登录校验
|
||||
$this->Is_Login();
|
||||
|
||||
// 权限校验
|
||||
$this->Is_Power();
|
||||
}
|
||||
|
||||
/**
|
||||
* [Index 生活号批量上下架列表]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-06T21:31:53+0800
|
||||
*/
|
||||
public function Index()
|
||||
{
|
||||
// 参数
|
||||
$params = array_merge($_POST, $_GET);
|
||||
|
||||
// 模型对象
|
||||
$m = M('AlipayLifeStatus');
|
||||
|
||||
// 条件
|
||||
$where = $this->GetIndexWhere();
|
||||
|
||||
// 分页
|
||||
$number = MyC('admin_page_number');
|
||||
$page_param = array(
|
||||
'number' => $number,
|
||||
'total' => $m->where($where)->count(),
|
||||
'where' => $params,
|
||||
'url' => U('Admin/AlipayLifeStatus/Index'),
|
||||
);
|
||||
$page = new \Library\Page($page_param);
|
||||
|
||||
// 获取列表
|
||||
$list = $m->where($where)->limit($page->GetPageStarNumber(), $number)->order('id desc')->select();
|
||||
$list = $this->SetDataHandle($list);
|
||||
|
||||
// 参数
|
||||
$this->assign('params', $params);
|
||||
|
||||
// 分页
|
||||
$this->assign('page_html', $page->GetPageHtml());
|
||||
|
||||
// 处理状态
|
||||
$this->assign('common_handle_status_list', L('common_handle_status_list'));
|
||||
|
||||
// 上下架
|
||||
$this->assign('common_shelves_select_list', L('common_shelves_select_list'));
|
||||
|
||||
// 数据列表
|
||||
$this->assign('list', $list);
|
||||
$this->display('Index');
|
||||
}
|
||||
|
||||
/**
|
||||
* [SetDataHandle 数据处理]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-29T21:27:15+0800
|
||||
* @param [array] $data [轮播图片数据]
|
||||
* @return [array] [处理好的数据]
|
||||
*/
|
||||
private function SetDataHandle($data)
|
||||
{
|
||||
if(!empty($data))
|
||||
{
|
||||
$common_handle_status_list = L('common_handle_status_list');
|
||||
$common_shelves_select_list = L('common_shelves_select_list');
|
||||
foreach($data as &$v)
|
||||
{
|
||||
// 状态
|
||||
$v['status_name'] = $common_handle_status_list[$v['status']]['name'];
|
||||
|
||||
// 上下架
|
||||
$v['is_shelves_name'] = $common_shelves_select_list[$v['is_shelves']]['name'];
|
||||
|
||||
// 生活号
|
||||
$v['alipay_life_all'] = empty($v['alipay_life_ids']) ? '' : M('AlipayLife')->where(['id'=>['in', json_decode($v['alipay_life_ids'], true)]])->getField('name', true);
|
||||
|
||||
// 时间
|
||||
$v['startup_time'] = empty($v['startup_time']) ? '' : date('Y-m-d H:i:s', $v['startup_time']);
|
||||
$v['success_time'] = empty($v['success_time']) ? '' : date('Y-m-d H:i:s', $v['success_time']);
|
||||
$v['add_time'] = date('Y-m-d H:i:s', $v['add_time']);
|
||||
$v['upd_time'] = empty($v['upd_time']) ? '' : date('Y-m-d H:i:s', $v['upd_time']);
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* [GetIndexWhere 列表条件]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-10T22:16:29+0800
|
||||
*/
|
||||
private function GetIndexWhere()
|
||||
{
|
||||
$where = array();
|
||||
|
||||
// 模糊
|
||||
if(!empty($_REQUEST['keyword']))
|
||||
{
|
||||
$where['name'] = array('like', '%'.I('keyword').'%');
|
||||
}
|
||||
|
||||
// 是否更多条件
|
||||
if(I('is_more', 0) == 1)
|
||||
{
|
||||
if(I('status', -1) > -1)
|
||||
{
|
||||
$where['status'] = intval(I('status', 0));
|
||||
}
|
||||
if(I('is_shelves', -1) > -1)
|
||||
{
|
||||
$where['is_shelves'] = intval(I('is_shelves', 0));
|
||||
}
|
||||
|
||||
// 表达式
|
||||
if(!empty($_REQUEST['time_start']))
|
||||
{
|
||||
$where['add_time'][] = array('gt', strtotime(I('time_start')));
|
||||
}
|
||||
if(!empty($_REQUEST['time_end']))
|
||||
{
|
||||
$where['add_time'][] = array('lt', strtotime(I('time_end')));
|
||||
}
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
|
||||
/**
|
||||
* [SaveInfo 添加/编辑页面]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-14T21:37:02+0800
|
||||
*/
|
||||
public function SaveInfo()
|
||||
{
|
||||
// 数据
|
||||
$data = empty($_REQUEST['id']) ? array() : M('AlipayLifeStatus')->find(I('id'));
|
||||
$this->assign('data', $data);
|
||||
|
||||
// 生活号
|
||||
$alipay_life_list = [];
|
||||
$alipay_life_ids_all = [];
|
||||
if(!empty($_GET['alipay_life_id']))
|
||||
{
|
||||
$alipay_life_ids_all = [intval(I('alipay_life_id'))];
|
||||
}
|
||||
if(!empty($data['alipay_life_ids']))
|
||||
{
|
||||
$alipay_life_ids_all = json_decode($data['alipay_life_ids'], true);
|
||||
}
|
||||
if(!empty($alipay_life_ids_all))
|
||||
{
|
||||
$alipay_life_list = M('AlipayLife')->field('id,name')->where(['id'=>['in', $alipay_life_ids_all]])->select();
|
||||
}
|
||||
$this->assign('alipay_life_ids_all', $alipay_life_ids_all);
|
||||
$this->assign('alipay_life_list', $alipay_life_list);
|
||||
|
||||
// 生活号分类
|
||||
$alipay_life_category = M('AlipayLifeCategory')->where(['is_enable'=>1])->field('id,name')->select();
|
||||
$this->assign('alipay_life_category', $alipay_life_category);
|
||||
|
||||
// 上下架
|
||||
$this->assign('common_shelves_select_list', L('common_shelves_select_list'));
|
||||
|
||||
// 参数
|
||||
$this->assign('params', array_merge($_POST, $_GET));
|
||||
$this->display('SaveInfo');
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-10-30
|
||||
* @desc description
|
||||
*/
|
||||
public function Detail()
|
||||
{
|
||||
// 参数
|
||||
$params = array_merge($_POST, $_GET);
|
||||
|
||||
// 获取列表
|
||||
$list = AlipayLifeService::StatusDetailList($params);
|
||||
|
||||
// 参数
|
||||
$this->assign('params', $params);
|
||||
|
||||
// 数据列表
|
||||
$this->assign('list', $list);
|
||||
$this->display('Detail');
|
||||
}
|
||||
|
||||
/**
|
||||
* [Save 生活号批量上下架保存]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-25T22:36:12+0800
|
||||
*/
|
||||
public function Save()
|
||||
{
|
||||
// 是否ajax请求
|
||||
if(!IS_AJAX)
|
||||
{
|
||||
$this->error(L('common_unauthorized_access'));
|
||||
}
|
||||
|
||||
$ret = AlipayLifeService::LifeStatusSave($_POST);
|
||||
$this->ajaxReturn($ret['msg'], $ret['code'], $ret['data']);
|
||||
}
|
||||
|
||||
/**
|
||||
* [Delete 生活号批量上下架删除]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-25T22:36:12+0800
|
||||
*/
|
||||
public function Delete()
|
||||
{
|
||||
// 是否ajax请求
|
||||
if(!IS_AJAX)
|
||||
{
|
||||
$this->error(L('common_unauthorized_access'));
|
||||
}
|
||||
|
||||
// 删除
|
||||
if(M('AlipayLifeStatus')->delete(intval(I('id'))))
|
||||
{
|
||||
$this->ajaxReturn(L('common_operation_delete_success'));
|
||||
}
|
||||
$this->ajaxReturn(L('common_operation_delete_error'), -100);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-10-24
|
||||
* @desc description
|
||||
*/
|
||||
public function Submit()
|
||||
{
|
||||
// 是否ajax请求
|
||||
if(!IS_AJAX)
|
||||
{
|
||||
$this->error(L('common_unauthorized_access'));
|
||||
}
|
||||
|
||||
$ret = AlipayLifeService::LifeStatusSubmit($_POST);
|
||||
$this->ajaxReturn($ret['msg'], $ret['code'], $ret['data']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生活号搜索
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-10-29
|
||||
* @desc description
|
||||
*/
|
||||
public function Search()
|
||||
{
|
||||
// 是否ajax请求
|
||||
if(!IS_AJAX)
|
||||
{
|
||||
$this->error(L('common_unauthorized_access'));
|
||||
}
|
||||
|
||||
$params = $_POST;
|
||||
$params['is_all'] = 1;
|
||||
$ret = AlipayLifeService::AlipayLifeSearch($params);
|
||||
$this->ajaxReturn($ret['msg'], $ret['code'], $ret['data']);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -9,7 +9,7 @@
|
||||
*/
|
||||
return array(
|
||||
// 添加/编辑
|
||||
'alipay_life_menu_add_name' => '生活号菜单创建',
|
||||
'alipay_life_menu_add_name' => '生活号菜单创建/编辑',
|
||||
'alipay_life_menu_content_title' => '生活号菜单内容',
|
||||
|
||||
'alipay_life_menu_life_text' => '生活号',
|
||||
@ -19,6 +19,7 @@ return array(
|
||||
'alipay_life_menu_pid_format' => '请选择父级',
|
||||
|
||||
'alipay_life_menu_name_text' => '名称',
|
||||
'alipay_life_menu_main_name_format' => '名称格式 1~30 个字符',
|
||||
'alipay_life_menu_name_format' => '名称格式 1~5 个字符',
|
||||
|
||||
'alipay_life_menu_type_text' => '菜单类型',
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
*/
|
||||
return array(
|
||||
// 添加/编辑
|
||||
'alipay_life_message_add_name' => '生活号消息创建',
|
||||
'alipay_life_message_add_name' => '生活号消息创建/编辑',
|
||||
'alipay_life_message_content_title' => '生活号消息内容',
|
||||
|
||||
'alipay_life_message_life_text' => '生活号',
|
||||
|
||||
37
service/Application/Admin/Lang/zh-cn/alipaylifestatus.php
Executable file
37
service/Application/Admin/Lang/zh-cn/alipaylifestatus.php
Executable file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 模块语言包-生活号批量上下架
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-01T21:51:08+0800
|
||||
*/
|
||||
return array(
|
||||
// 添加/编辑
|
||||
'alipay_life_status_add_name' => '生活号批量上下架创建/编辑',
|
||||
|
||||
'alipay_life_status_life_text' => '生活号',
|
||||
'alipay_life_status_life_format' => '请选择生活号',
|
||||
|
||||
'alipay_life_status_pid_text' => '父级',
|
||||
'alipay_life_status_pid_format' => '请选择父级',
|
||||
|
||||
'alipay_life_status_name_text' => '名称',
|
||||
'alipay_life_status_name_format' => '名称格式 1~30 个字符',
|
||||
|
||||
'alipay_life_status_startup_time_text' => '处理启动时间',
|
||||
'alipay_life_status_success_time_text' => '处理完成时间',
|
||||
|
||||
'alipay_life_status_is_shelves_text' => '上下架',
|
||||
'alipay_life_status_is_shelves_format' => '请选择上下架',
|
||||
|
||||
'alipay_life_status_optional_text' => '可选',
|
||||
'alipay_life_status_selected_text' => '已选',
|
||||
'alipay_life_status_selected_all_text' => '全选',
|
||||
'alipay_life_status_detail_text' => '详情',
|
||||
|
||||
'alipay_life_status_send_time_text' => '处理时间',
|
||||
'alipay_life_status_return_msg_text' => '处理描述',
|
||||
);
|
||||
?>
|
||||
@ -87,13 +87,7 @@
|
||||
<a href="{{:U('Admin/AlipayLife/SaveInfo', array('id'=>$v['id']))}}">
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-edit"> {{:L('common_operation_edit')}}</button>
|
||||
</a>
|
||||
<if condition="$v['is_shelves'] eq 0">
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-trash-o submit-delete" data-url="{{:U('Admin/AlipayLife/Delete')}}" data-id="{{$v.id}}"> {{:L('common_operation_delete')}}</button>
|
||||
<else />
|
||||
<a href="{{:U('Admin/AlipayLifeMessage/SaveInfo', ['alipay_life_id'=>$v['id']])}}">
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-send-o"> {{:L('alipay_life_user_send_text')}}</button>
|
||||
</a>
|
||||
</if>
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-trash-o submit-delete" data-url="{{:U('Admin/AlipayLife/Delete')}}" data-id="{{$v.id}}"> {{:L('common_operation_delete')}}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</foreach>
|
||||
|
||||
@ -97,11 +97,13 @@
|
||||
</td>
|
||||
<td class="view-operation">
|
||||
<if condition="$v['status'] eq 0">
|
||||
<a href="{{:U('Admin/AlipayLifeMenu/ContentSaveInfo', array('id'=>$v['id'], 'menu_id'=>$params['menu_id']))}}">
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-edit"> {{:L('common_operation_edit')}}</button>
|
||||
</a>
|
||||
<if condition="in_array($data['status'], [0,4])">
|
||||
<a href="{{:U('Admin/AlipayLifeMenu/ContentSaveInfo', array('id'=>$v['id'], 'menu_id'=>$params['menu_id']))}}">
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-edit"> {{:L('common_operation_edit')}}</button>
|
||||
</a>
|
||||
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-trash-o submit-delete" data-url="{{:U('Admin/AlipayLifeMenu/ContentDelete')}}" data-id="{{$v.id}}"> {{:L('common_operation_delete')}}</button>
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-trash-o submit-delete" data-url="{{:U('Admin/AlipayLifeMenu/ContentDelete')}}" data-id="{{$v.id}}"> {{:L('common_operation_delete')}}</button>
|
||||
</if>
|
||||
</if>
|
||||
</td>
|
||||
</tr>
|
||||
@ -166,11 +168,13 @@
|
||||
</td>
|
||||
<td class="view-operation">
|
||||
<if condition="$v['status'] eq 0">
|
||||
<a href="{{:U('Admin/AlipayLifeMenu/ContentSaveInfo', array('id'=>$vs['id'], 'menu_id'=>$params['menu_id']))}}">
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-edit"> {{:L('common_operation_edit')}}</button>
|
||||
</a>
|
||||
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-trash-o submit-delete" data-url="{{:U('Admin/AlipayLifeMenu/ContentDelete')}}" data-id="{{$vs.id}}"> {{:L('common_operation_delete')}}</button>
|
||||
<if condition="in_array($data['status'], [0,4])">
|
||||
<a href="{{:U('Admin/AlipayLifeMenu/ContentSaveInfo', array('id'=>$vs['id'], 'menu_id'=>$params['menu_id']))}}">
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-edit"> {{:L('common_operation_edit')}}</button>
|
||||
</a>
|
||||
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-trash-o submit-delete" data-url="{{:U('Admin/AlipayLifeMenu/ContentDelete')}}" data-id="{{$vs.id}}"> {{:L('common_operation_delete')}}</button>
|
||||
</if>
|
||||
</if>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -105,10 +105,6 @@
|
||||
<if condition="in_array($v['status'], [0,4])">
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-send-o submit-ajax" data-url="{{:U('Admin/AlipayLifeMenu/Release')}}" data-id="{{$v.id}}" data-view="reload"> {{:L('common_operation_release')}}</button>
|
||||
|
||||
<a href="{{:U('Admin/AlipayLifeMenu/ContentIndex', array('menu_id'=>$v['id']))}}">
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-cubes"> {{:L('alipay_life_menu_content_text')}}</button>
|
||||
</a>
|
||||
|
||||
<a href="{{:U('Admin/AlipayLifeMenu/SaveInfo', array('id'=>$v['id']))}}">
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-edit"> {{:L('common_operation_edit')}}</button>
|
||||
</a>
|
||||
@ -116,6 +112,10 @@
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-trash-o submit-delete" data-url="{{:U('Admin/AlipayLifeMenu/Delete')}}" data-id="{{$v.id}}"> {{:L('common_operation_delete')}}</button>
|
||||
</if>
|
||||
|
||||
<a href="{{:U('Admin/AlipayLifeMenu/ContentIndex', array('menu_id'=>$v['id']))}}">
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-cubes"> {{:L('alipay_life_menu_content_text')}}</button>
|
||||
</a>
|
||||
|
||||
<a href="{{:U('Admin/AlipayLifeMenu/Detail', array('message_id'=>$v['id']))}}">
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-align-left"> {{:L('alipay_life_menu_detail_text')}}</button>
|
||||
</a>
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
<div class="am-form-group">
|
||||
<label>{{:L('alipay_life_menu_name_text')}}</label>
|
||||
<input type="text" name="name" placeholder="{{:L('alipay_life_menu_name_text')}}" data-validation-message="{{:L('alipay_life_menu_name_format')}}" class="am-radius" maxlength="255" value="<notempty name="data.name">{{$data.name}}</notempty>" required />
|
||||
<input type="text" name="name" placeholder="{{:L('alipay_life_menu_name_text')}}" data-validation-message="{{:L('alipay_life_menu_main_name_format')}}" class="am-radius" maxlength="30" value="<notempty name="data.name">{{$data.name}}</notempty>" required />
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
|
||||
@ -98,7 +98,7 @@
|
||||
</div>
|
||||
</td>
|
||||
<td class="view-operation">
|
||||
<if condition="$v['status'] eq 0">
|
||||
<if condition="in_array($data['status'], [0,4])">
|
||||
<a href="{{:U('Admin/AlipayLifeMessage/ContentSaveInfo', array('id'=>$v['id'], 'message_id'=>$params['message_id']))}}">
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-edit"> {{:L('common_operation_edit')}}</button>
|
||||
</a>
|
||||
|
||||
@ -112,10 +112,6 @@
|
||||
<if condition="in_array($v['status'], [0,4])">
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-send-o submit-ajax" data-url="{{:U('Admin/AlipayLifeMessage/Send')}}" data-id="{{$v.id}}" data-view="reload"> {{:L('common_send_text')}}</button>
|
||||
|
||||
<a href="{{:U('Admin/AlipayLifeMessage/ContentIndex', array('message_id'=>$v['id']))}}">
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-cubes"> {{:L('alipay_life_message_content_text')}}</button>
|
||||
</a>
|
||||
|
||||
<a href="{{:U('Admin/AlipayLifeMessage/SaveInfo', array('id'=>$v['id']))}}">
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-edit"> {{:L('common_operation_edit')}}</button>
|
||||
</a>
|
||||
@ -123,6 +119,10 @@
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-trash-o submit-delete" data-url="{{:U('Admin/AlipayLifeMessage/Delete')}}" data-id="{{$v.id}}"> {{:L('common_operation_delete')}}</button>
|
||||
</if>
|
||||
|
||||
<a href="{{:U('Admin/AlipayLifeMessage/ContentIndex', array('message_id'=>$v['id']))}}">
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-cubes"> {{:L('alipay_life_message_content_text')}}</button>
|
||||
</a>
|
||||
|
||||
<a href="{{:U('Admin/AlipayLifeMessage/Detail', array('message_id'=>$v['id']))}}">
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-align-left"> {{:L('alipay_life_message_detail_text')}}</button>
|
||||
</a>
|
||||
|
||||
78
service/Application/Admin/View/Default/AlipayLifeStatus/Detail.html
Executable file
78
service/Application/Admin/View/Default/AlipayLifeStatus/Detail.html
Executable file
@ -0,0 +1,78 @@
|
||||
<include file="Public/Header" />
|
||||
|
||||
<!-- right content start -->
|
||||
<div class="content-right">
|
||||
<div class="content">
|
||||
<!-- back nav start -->
|
||||
<legend>
|
||||
<span class="fs-16">{{:L('alipay_life_status_detail_text')}}</span>
|
||||
<a href="{{:U('Admin/AlipayLifeStatus/Index')}}" class="fr fs-14 m-t-5 am-icon-mail-reply"> {{:L('common_operation_back')}}</a>
|
||||
</legend>
|
||||
<!-- back nav end -->
|
||||
|
||||
<!-- list start -->
|
||||
<table class="am-table am-table-striped am-table-hover am-text-middle m-t-10">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{:L('alipay_life_status_life_text')}}</th>
|
||||
<th>{{:L('common_view_status_title')}}</th>
|
||||
<th>{{:L('alipay_life_status_send_time_text')}}</th>
|
||||
<th>{{:L('alipay_life_status_return_msg_text')}}</th>
|
||||
<th>{{:L('common_more_name')}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<if condition="!empty($list)">
|
||||
<foreach name="list" item="v">
|
||||
<tr id="data-list-{{$v.id}}">
|
||||
<td>{{$v.alipay_life_name}}</td>
|
||||
<td>{{$v.status_name}}</td>
|
||||
<td>{{$v.send_time}}</td>
|
||||
<td>{{$v.return_msg}}</td>
|
||||
<td>
|
||||
<span class="am-icon-caret-down c-p" data-am-modal="{target: '#my-popup{{$v.id}}'}"> {{:L('common_see_more_name')}}</span>
|
||||
<div class="am-popup am-radius" id="my-popup{{$v.id}}">
|
||||
<div class="am-popup-inner">
|
||||
<div class="am-popup-hd">
|
||||
<h4 class="am-popup-title">{{:L('common_detail_content')}}</h4>
|
||||
<span data-am-modal-close class="am-close">×</span>
|
||||
</div>
|
||||
<div class="am-popup-bd">
|
||||
<dl class="dl-content">
|
||||
<dt>{{:L('alipay_life_status_life_text')}}</dt>
|
||||
<dd><if condition="empty($v['alipay_life_name'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.alipay_life_name}}</if></dd>
|
||||
|
||||
<dt>{{:L('common_view_status_title')}}</dt>
|
||||
<dd><if condition="empty($v['status_name'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.status_name}}</if></dd>
|
||||
|
||||
<dt>{{:L('alipay_life_status_send_time_text')}}</dt>
|
||||
<dd>{{$v.send_time}}</dd>
|
||||
|
||||
<dt>{{:L('alipay_life_status_return_msg_text')}}</dt>
|
||||
<dd>{{$v.return_msg}}</dd>
|
||||
|
||||
<dt>{{:L('common_create_time_name')}}</dt>
|
||||
<dd>{{$v.add_time}}</dd>
|
||||
|
||||
<dt>{{:L('common_upd_time_name')}}</dt>
|
||||
<dd>{{$v.upd_time}}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</foreach>
|
||||
<else />
|
||||
<tr><td colspan="20" class="table-no">{{:L('common_not_data_tips')}}</td></tr>
|
||||
</if>
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- list end -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- right content end -->
|
||||
|
||||
<!-- footer start -->
|
||||
<include file="Public/Footer" />
|
||||
<!-- footer end -->
|
||||
139
service/Application/Admin/View/Default/AlipayLifeStatus/Index.html
Executable file
139
service/Application/Admin/View/Default/AlipayLifeStatus/Index.html
Executable file
@ -0,0 +1,139 @@
|
||||
<include file="Public/Header" />
|
||||
|
||||
<!-- right content start -->
|
||||
<div class="content-right">
|
||||
<div class="content">
|
||||
<!-- form start -->
|
||||
<form class="am-form view-list" action="{{:U('Admin/AlipayLifeStatus/Index')}}" method="POST">
|
||||
<div class="am-g">
|
||||
<input type="text" class="am-radius form-keyword" placeholder="{{:L('alipay_life_status_name_text')}}" name="keyword" <present name="params['keyword']"> value="{{$params.keyword}}"</present> />
|
||||
<button type="submit" class="am-btn am-btn-secondary am-btn-sm am-radius form-submit">{{:L('common_operation_query')}}</button>
|
||||
<label class="fs-12 m-l-5 c-p fw-100 more-submit">
|
||||
{{:L('common_more_screening')}}
|
||||
<input type="checkbox" name="is_more" value="1" id="is_more" <if condition="isset($params['is_more']) and $params['is_more'] eq 1">checked</if> />
|
||||
<i class="am-icon-angle-down"></i>
|
||||
</label>
|
||||
|
||||
<div class="more-where <if condition="!isset($params['is_more']) or $params['is_more'] neq 1">none</if>">
|
||||
<select name="status" class="am-radius c-p m-t-10 m-l-5 param-where">
|
||||
<option value="-1">{{:L('common_view_status_title')}}</option>
|
||||
<foreach name="common_handle_status_list" item="v">
|
||||
<option value="{{$v.value}}" <if condition="isset($params['status']) and $params['status'] eq $v['value']">selected</if>>{{$v.name}}</option>
|
||||
</foreach>
|
||||
</select>
|
||||
<select name="is_shelves" class="am-radius c-p m-t-10 m-l-5 param-where">
|
||||
<option value="-1">{{:L('alipay_life_status_is_shelves_text')}}</option>
|
||||
<foreach name="common_shelves_select_list" item="v">
|
||||
<option value="{{$v.value}}" <if condition="isset($params['is_shelves']) and $params['is_shelves'] eq $v['value']">selected</if>>{{$v.name}}</option>
|
||||
</foreach>
|
||||
</select>
|
||||
<div class="param-date param-where m-l-5">
|
||||
<input type="text" name="time_start" class="Wdate am-radius m-t-10" placeholder="{{:L('common_time_start_name')}}" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd HH:mm:ss'})" <if condition="isset($params['time_start'])">value="{{$params.time_start}}"</if>/>
|
||||
<span>~</span>
|
||||
<input type="text" class="Wdate am-radius m-t-10" placeholder="{{:L('common_time_end_name')}}" name="time_end" onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd HH:mm:ss'})" <if condition="isset($params['time_end'])">value="{{$params.time_end}}"</if>/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<!-- form end -->
|
||||
|
||||
<!-- operation start -->
|
||||
<div class="am-g m-t-15">
|
||||
<a href="{{:U('Admin/AlipayLifeStatus/SaveInfo')}}" class="am-btn am-btn-secondary am-radius am-btn-xs am-icon-plus"> {{:L('common_operation_add')}}</a>
|
||||
</div>
|
||||
<!-- operation end -->
|
||||
|
||||
<!-- list start -->
|
||||
<table class="am-table am-table-striped am-table-hover am-text-middle m-t-10">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{:L('alipay_life_status_name_text')}}</th>
|
||||
<th>{{:L('alipay_life_status_is_shelves_text')}}</th>
|
||||
<th class="am-hide-sm-only alipay-life-row">{{:L('alipay_life_status_life_text')}}</th>
|
||||
<th>{{:L('common_view_status_title')}}</th>
|
||||
<th>{{:L('common_more_name')}}</th>
|
||||
<th>{{:L('common_operation_name')}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<if condition="!empty($list)">
|
||||
<foreach name="list" item="v">
|
||||
<tr id="data-list-{{$v.id}}">
|
||||
<td>{{$v.name}}</td>
|
||||
<td>{{$v.is_shelves_name}}</td>
|
||||
<td class="am-hide-sm-only">{{:implode(',', $v['alipay_life_all'])}}</td>
|
||||
<td>{{$v.status_name}}</td>
|
||||
<td>
|
||||
<span class="am-icon-caret-down c-p" data-am-modal="{target: '#my-popup{{$v.id}}'}"> {{:L('common_see_more_name')}}</span>
|
||||
<div class="am-popup am-radius" id="my-popup{{$v.id}}">
|
||||
<div class="am-popup-inner">
|
||||
<div class="am-popup-hd">
|
||||
<h4 class="am-popup-title">{{:L('common_detail_content')}}</h4>
|
||||
<span data-am-modal-close class="am-close">×</span>
|
||||
</div>
|
||||
<div class="am-popup-bd">
|
||||
<dl class="dl-content">
|
||||
<dt>{{:L('alipay_life_status_name_text')}}</dt>
|
||||
<dd><if condition="empty($v['name'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.name}}</if></dd>
|
||||
|
||||
<dt>{{:L('alipay_life_status_is_shelves_text')}}</dt>
|
||||
<dd><if condition="empty($v['is_shelves_name'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.is_shelves_name}}</if></dd>
|
||||
|
||||
<dt>{{:L('alipay_life_status_life_text')}}</dt>
|
||||
<dd><if condition="empty($v['alipay_life_all'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{:implode(',', $v['alipay_life_all'])}}</if></dd>
|
||||
|
||||
<dt>{{:L('common_view_status_title')}}</dt>
|
||||
<dd><if condition="empty($v['status_name'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.status_name}}</if></dd>
|
||||
|
||||
<dt>{{:L('alipay_life_status_startup_time_text')}}</dt>
|
||||
<dd>{{$v.startup_time}}</dd>
|
||||
|
||||
<dt>{{:L('alipay_life_status_success_time_text')}}</dt>
|
||||
<dd>{{$v.success_time}}</dd>
|
||||
|
||||
<dt>{{:L('common_create_time_name')}}</dt>
|
||||
<dd>{{$v.add_time}}</dd>
|
||||
|
||||
<dt>{{:L('common_upd_time_name')}}</dt>
|
||||
<dd>{{$v.upd_time}}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="view-operation">
|
||||
<if condition="in_array($v['status'], [0,4])">
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-send-o submit-ajax" data-url="{{:U('Admin/AlipayLifeStatus/Submit')}}" data-id="{{$v.id}}" data-view="reload"> {{:L('common_operation_submit')}}</button>
|
||||
|
||||
<a href="{{:U('Admin/AlipayLifeStatus/SaveInfo', array('id'=>$v['id']))}}">
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-edit"> {{:L('common_operation_edit')}}</button>
|
||||
</a>
|
||||
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-trash-o submit-delete" data-url="{{:U('Admin/AlipayLifeStatus/Delete')}}" data-id="{{$v.id}}"> {{:L('common_operation_delete')}}</button>
|
||||
</if>
|
||||
|
||||
<a href="{{:U('Admin/AlipayLifeStatus/Detail', array('status_id'=>$v['id']))}}">
|
||||
<button class="am-btn am-btn-default am-btn-xs am-radius am-icon-align-left"> {{:L('alipay_life_status_detail_text')}}</button>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</foreach>
|
||||
<else />
|
||||
<tr><td colspan="20" class="table-no">{{:L('common_not_data_tips')}}</td></tr>
|
||||
</if>
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- list end -->
|
||||
|
||||
<!-- page start -->
|
||||
<if condition="!empty($list)">
|
||||
{{$page_html}}
|
||||
</if>
|
||||
<!-- page end -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- right content end -->
|
||||
|
||||
<!-- footer start -->
|
||||
<include file="Public/Footer" />
|
||||
<!-- footer end -->
|
||||
78
service/Application/Admin/View/Default/AlipayLifeStatus/SaveInfo.html
Executable file
78
service/Application/Admin/View/Default/AlipayLifeStatus/SaveInfo.html
Executable file
@ -0,0 +1,78 @@
|
||||
<include file="Public/Header" />
|
||||
|
||||
<!-- right content start -->
|
||||
<div class="content-right">
|
||||
<div class="content">
|
||||
<!-- form start -->
|
||||
<form class="am-form form-validation view-save" action="{{:U('Admin/AlipayLifeStatus/Save')}}" method="POST" request-type="ajax-url" request-value="{{:U('Admin/AlipayLifeStatus/Index')}}" enctype="multipart/form-data">
|
||||
<input type="hidden" name="max_file_size" value="{{:MyC('home_max_limit_image', 2048000)}}" />
|
||||
<legend>
|
||||
<span class="fs-16">{{:L('alipay_life_status_add_name')}}</span>
|
||||
<a href="{{:U('Admin/AlipayLifeStatus/Index')}}" class="fr fs-14 m-t-5 am-icon-mail-reply"> {{:L('common_operation_back')}}</a>
|
||||
</legend>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label>{{:L('alipay_life_status_name_text')}}</label>
|
||||
<input type="text" name="name" placeholder="{{:L('alipay_life_status_name_text')}}" data-validation-message="{{:L('alipay_life_status_name_format')}}" class="am-radius" maxlength="30" value="<notempty name="data.name">{{$data.name}}</notempty>" required />
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="block">{{:L('alipay_life_status_is_shelves_text')}}</label>
|
||||
<select name="is_shelves" class="am-radius c-p chosen-select" data-placeholder="{{:L('common_select_can_choose')}}" data-validation-message="{{:L('alipay_life_status_is_shelves_format')}}" <if condition="isset($data['status']) and $data['status'] neq 0">disabled</if> required>
|
||||
<option value="">{{:L('common_select_can_choose')}}</option>
|
||||
<foreach name="common_shelves_select_list" item="v">
|
||||
<option value="{{$v.value}}" <if condition="isset($data['is_shelves']) and $v['value'] eq $data['is_shelves']">selected</if>>{{$v.name}}</option>
|
||||
</foreach>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- 生活号容器 -->
|
||||
<div class="life-container">
|
||||
<label class="block">{{:L('alipay_life_status_life_text')}}</label>
|
||||
<div class="life-form" data-search-url="{{:U('Admin/AlipayLifeStatus/Search')}}">
|
||||
<select class="am-radius c-p chosen-select life-form-category" data-placeholder="{{:L('common_select_can_choose')}}" data-validation-message="{{:L('alipay_life_status_category_format')}}">
|
||||
<option value="">{{:L('common_select_can_choose')}}</option>
|
||||
<foreach name="alipay_life_category" item="v">
|
||||
<option value="{{$v.id}}">{{$v.name}}</option>
|
||||
</foreach>
|
||||
</select>
|
||||
<input type="text" placeholder="{{:L('alipay_life_status_name_text')}}" class="am-radius life-form-keywords" />
|
||||
<button type="button" class="am-btn am-btn-secondary am-radius am-btn-sm search-submit">{{:L('common_so_text')}}</button>
|
||||
</div>
|
||||
<div class="am-form-group life-list">
|
||||
<input type="text" name="alipay_life_ids" value="<notempty name="data.alipay_life_ids">{{:implode(',', json_decode($data['alipay_life_ids'], true))}}</notempty>" data-validation-message="{{:L('alipay_life_status_life_format')}}" required />
|
||||
<div class="life-items am-fl">
|
||||
<div class="title">{{:L('alipay_life_status_optional_text')}}</div>
|
||||
<ul class="life-content am-list ul-left">
|
||||
<div class="table-no">{{:L('common_not_data_tips')}}</div>
|
||||
</ul>
|
||||
</div>
|
||||
<button type="button" class="am-btn am-btn-default am-btn-xs selected-all">{{:L('alipay_life_status_selected_all_text')}} <i class="am-icon-angle-double-right"></i></button>
|
||||
<div class="life-items am-fr">
|
||||
<div class="title">{{:L('alipay_life_status_selected_text')}}</div>
|
||||
<ul class="life-content am-list ul-right">
|
||||
<div class="table-no <notempty name="data">none</notempty>">{{:L('common_not_data_tips')}}</div>
|
||||
<foreach name="alipay_life_list" item="v">
|
||||
<li class="am-animation-slide-bottom items-li-{{$v.id}}">
|
||||
<span class="name" data-value="{{$v.id}}">{{$v.name}}</span>
|
||||
<i class="am-icon-trash-o am-fr"></i>
|
||||
</li>
|
||||
</foreach>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<input type="hidden" name="id" value="<notempty name="params.id">{{$params.id}}</notempty>" />
|
||||
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm w100" data-am-loading="{loadingText:'{{:L('common_form_loading_tips')}}'}">{{:L('common_operation_save')}}</button>
|
||||
</div>
|
||||
</form>
|
||||
<!-- form end -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- right content end -->
|
||||
|
||||
<!-- footer start -->
|
||||
<include file="Public/Footer" />
|
||||
<!-- footer end -->
|
||||
@ -90,5 +90,18 @@ class AlipayLifeController extends CommonController
|
||||
{
|
||||
AlipayLifeService::MenuRelease($_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生活号批量上下架
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-10-24
|
||||
* @desc description
|
||||
*/
|
||||
public function StatusHandle()
|
||||
{
|
||||
AlipayLifeService::StatusHandle($_REQUEST);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -541,6 +541,15 @@ return array(
|
||||
4 => array('value' => 4, 'name' => '发布失败'),
|
||||
),
|
||||
|
||||
// 处理状态
|
||||
'common_handle_status_list' => array(
|
||||
0 => array('value' => 0, 'name' => '未处理'),
|
||||
1 => array('value' => 1, 'name' => '处理中'),
|
||||
2 => array('value' => 2, 'name' => '已处理'),
|
||||
3 => array('value' => 3, 'name' => '部分成功'),
|
||||
4 => array('value' => 4, 'name' => '处理失败'),
|
||||
),
|
||||
|
||||
// 支付宝生活号菜单事件类型
|
||||
'common_alipay_life_menu_action_type_list' => array(
|
||||
0 => array('value' => 0, 'out_value' => 'out', 'name' => '事件型菜单'),
|
||||
@ -556,6 +565,12 @@ return array(
|
||||
1 => array('value' => 1, 'name' => '文字+图标'),
|
||||
),
|
||||
|
||||
// 上下架选择
|
||||
'common_shelves_select_list' => array(
|
||||
0 => array('value' => 0, 'name' => '下架'),
|
||||
1 => array('value' => 1, 'name' => '上架', 'checked' => true),
|
||||
),
|
||||
|
||||
|
||||
// 色彩值
|
||||
'common_color_list' => array(
|
||||
|
||||
@ -534,6 +534,13 @@ class AlipayLife
|
||||
{
|
||||
return ['status'=>0, 'msg'=>'操作成功'];
|
||||
}
|
||||
|
||||
// 是否相同状态下操作
|
||||
if(stripos($result[$key]['sub_code'], 'LIFE_ALREADY_DEBARK') !== false || stripos($result[$key]['sub_code'], 'LIFE_ALREADY_ON_PLATFORM') !== false)
|
||||
{
|
||||
return ['status'=>0, 'msg'=>$result[$key]['sub_msg'].'['.$result[$key]['code'].']'];
|
||||
}
|
||||
|
||||
return ['status'=>-100, 'msg'=>$result[$key]['sub_msg'].'['.$result[$key]['code'].']'];
|
||||
}
|
||||
|
||||
|
||||
@ -404,27 +404,27 @@ class AlipayLifeService
|
||||
return DataReturn($ret, -1);
|
||||
}
|
||||
|
||||
// 获取消息
|
||||
// 获取数据
|
||||
$m = M('AlipayLifeMessage');
|
||||
$message = $m->find(intval($params['id']));
|
||||
if(empty($message))
|
||||
$data = $m->find(intval($params['id']));
|
||||
if(empty($data))
|
||||
{
|
||||
return DataReturn('消息纪录不存在', -1);
|
||||
return DataReturn('消息记录不存在', -1);
|
||||
}
|
||||
$common_send_status_list = L('common_send_status_list');
|
||||
if(!in_array($message['status'], [0,4]))
|
||||
if(!in_array($data['status'], [0,4]))
|
||||
{
|
||||
return DataReturn('状态不可操作['.$common_send_status_list[$message['status']]['name'].']', -2);
|
||||
return DataReturn('状态不可操作['.$common_send_status_list[$data['status']]['name'].']', -2);
|
||||
}
|
||||
|
||||
// 获取消息内容
|
||||
$content_count = (int) M('AlipayLifeMessageContent')->where(['alipay_life_message_id'=>$message['id']])->count();
|
||||
// 获取数据内容
|
||||
$content_count = (int) M('AlipayLifeMessageContent')->where(['alipay_life_message_id'=>$data['id']])->count();
|
||||
if(empty($content_count))
|
||||
{
|
||||
return DataReturn('消息内容不能为空', -1);
|
||||
}
|
||||
|
||||
switch($message['send_type'])
|
||||
switch($data['send_type'])
|
||||
{
|
||||
case 0 :
|
||||
if($content_count > 1)
|
||||
@ -442,27 +442,27 @@ class AlipayLifeService
|
||||
}
|
||||
|
||||
// 发送类型
|
||||
$data = [];
|
||||
if($message['send_type'] == 1)
|
||||
$detail = [];
|
||||
if($data['send_type'] == 1)
|
||||
{
|
||||
$alipay_life_all = json_decode($message['alipay_life_ids'], true);
|
||||
$alipay_life_all = json_decode($data['alipay_life_ids'], true);
|
||||
foreach($alipay_life_all as $alipay_life_id)
|
||||
{
|
||||
$data[] = [
|
||||
$detail[] = [
|
||||
'alipay_life_id' => $alipay_life_id,
|
||||
'alipay_life_message_id'=> $message['id'],
|
||||
'alipay_life_message_id'=> $data['id'],
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$alipay_openid = M('User')->where(['id'=>$message['user_id']])->getField('alipay_openid');
|
||||
$alipay_openid = M('User')->where(['id'=>$data['user_id']])->getField('alipay_openid');
|
||||
if(!empty($alipay_openid))
|
||||
{
|
||||
$data[] = [
|
||||
'user_id' => $message['user_id'],
|
||||
'alipay_life_id' => M('AlipayLifeUser')->where(['id'=>$message['alipay_life_user_id']])->getField('alipay_life_id'),
|
||||
'alipay_life_user_id' => $message['alipay_life_user_id'],
|
||||
$detail[] = [
|
||||
'user_id' => $data['user_id'],
|
||||
'alipay_life_id' => M('AlipayLifeUser')->where(['id'=>$data['alipay_life_user_id']])->getField('alipay_life_id'),
|
||||
'alipay_life_user_id' => $data['alipay_life_user_id'],
|
||||
'alipay_openid' => $alipay_openid,
|
||||
'alipay_life_message_id'=> $message['id'],
|
||||
'alipay_life_message_id'=> $data['id'],
|
||||
];
|
||||
}
|
||||
|
||||
@ -470,12 +470,12 @@ class AlipayLifeService
|
||||
|
||||
// 入库详情表
|
||||
$m->startTrans();
|
||||
if(M('AlipayLifeMessageDetail')->addAll($data) !== false)
|
||||
if(M('AlipayLifeMessageDetail')->addAll($detail) !== false)
|
||||
{
|
||||
if($m->where(['id'=>$message['id']])->save(['status'=>1, 'startup_time'=>time(), 'upd_time'=>time()]) !== false)
|
||||
if($m->where(['id'=>$data['id']])->save(['status'=>1, 'startup_time'=>time(), 'upd_time'=>time()]) !== false)
|
||||
{
|
||||
$m->commit();
|
||||
self::SyncJobSend($message['id'], 'message_id', 'MessageSend');
|
||||
self::SyncJobSend($data['id'], 'message_id', 'MessageSend');
|
||||
return DataReturn(L('common_submit_success'), 0);
|
||||
}
|
||||
}
|
||||
@ -517,33 +517,33 @@ class AlipayLifeService
|
||||
|
||||
// 启动开始
|
||||
echo '[start_time:'.date('Y-m-d H:i:s')."]\n";
|
||||
echo '[message:'.$params['message_id']."]\n";
|
||||
echo '[data:'.$params['message_id']."]\n";
|
||||
|
||||
// 开始处理
|
||||
$m = M('AlipayLifeMessage');
|
||||
$message = $m->find($params['message_id']);
|
||||
if(empty($message))
|
||||
$data = $m->find($params['message_id']);
|
||||
if(empty($data))
|
||||
{
|
||||
die('[time:'.date('Y-m-d H:i:s')."][msg:{$params['message_id']}数据不存在]\n\n");
|
||||
}
|
||||
if(!in_array($message['status'], [1]))
|
||||
if(!in_array($data['status'], [1]))
|
||||
{
|
||||
die('[time:'.date('Y-m-d H:i:s')."][msg:{$message['status']}状态不可操作]\n\n");
|
||||
die('[time:'.date('Y-m-d H:i:s')."][msg:{$data['status']}状态不可操作]\n\n");
|
||||
}
|
||||
|
||||
// 发送消息类型
|
||||
if($message['send_type'] == 1)
|
||||
if($data['send_type'] == 1)
|
||||
{
|
||||
$alipay_life_all = json_decode($message['alipay_life_ids'], true);
|
||||
$alipay_life_all = json_decode($data['alipay_life_ids'], true);
|
||||
} else {
|
||||
$alipay_life_all = [M('AlipayLifeUser')->where(['id'=>$message['alipay_life_user_id']])->getField('alipay_life_id')];
|
||||
$alipay_life_all = [M('AlipayLifeUser')->where(['id'=>$data['alipay_life_user_id']])->getField('alipay_life_id')];
|
||||
}
|
||||
|
||||
// 消息内容
|
||||
$message['content'] = M('AlipayLifeMessageContent')->field('id,title,content,out_image_url,url,action_name')->where(['alipay_life_message_id'=>$message['id']])->select();
|
||||
if(empty($message['content']))
|
||||
$data['content'] = M('AlipayLifeMessageContent')->field('id,title,content,out_image_url,url,action_name')->where(['alipay_life_message_id'=>$data['id']])->select();
|
||||
if(empty($data['content']))
|
||||
{
|
||||
die('[time:'.date('Y-m-d H:i:s')."][msg:{$message['id']}消息内容为空]\n\n");
|
||||
die('[time:'.date('Y-m-d H:i:s')."][msg:{$data['id']}消息内容为空]\n\n");
|
||||
}
|
||||
|
||||
// 生活号循环处理
|
||||
@ -554,7 +554,7 @@ class AlipayLifeService
|
||||
$life = M('AlipayLife')->find($alipay_life_id);
|
||||
|
||||
// 获取消息详情
|
||||
$detail = $detail_m->where(['alipay_life_message_id'=>$message['id'], 'status'=>0])->limit(100)->select();
|
||||
$detail = $detail_m->where(['alipay_life_message_id'=>$data['id'], 'status'=>0])->limit(30)->select();
|
||||
|
||||
if(!empty($detail))
|
||||
{
|
||||
@ -562,14 +562,14 @@ class AlipayLifeService
|
||||
foreach($detail as $v)
|
||||
{
|
||||
// 群发
|
||||
if($message['send_type'] == 1)
|
||||
if($data['send_type'] == 1)
|
||||
{
|
||||
// 请求接口处理
|
||||
$ret = $obj->GroupSend($message);
|
||||
$ret = $obj->GroupSend($data);
|
||||
} else {
|
||||
// 请求接口处理
|
||||
$message['alipay_openid'] = $v['alipay_openid'];
|
||||
$ret = $obj->CustomSend($message);
|
||||
$data['alipay_openid'] = $v['alipay_openid'];
|
||||
$ret = $obj->CustomSend($data);
|
||||
}
|
||||
|
||||
// 返回状态更新
|
||||
@ -578,21 +578,21 @@ class AlipayLifeService
|
||||
}
|
||||
echo '[count:'.count($detail).']';
|
||||
} else {
|
||||
$status_all = $detail_m->where(['alipay_life_message_id'=>$message['id']])->group('status')->getField('status', true);
|
||||
$status_all = $detail_m->where(['alipay_life_message_id'=>$data['id']])->group('status')->getField('status', true);
|
||||
if(count($status_all) <= 1)
|
||||
{
|
||||
$status = in_array(2, $status_all) ? 2 : 4;
|
||||
} else {
|
||||
$status = 3;
|
||||
}
|
||||
$m->where(['id'=>$message['id']])->save(['success_time'=>time(), 'status'=>$status, 'upd_time'=>time()]);
|
||||
$m->where(['id'=>$data['id']])->save(['success_time'=>time(), 'status'=>$status, 'upd_time'=>time()]);
|
||||
echo '[success_time:'.date('Y-m-d H:i:s')."]\n";
|
||||
echo '[message:'.$params['message_id']."]\n\n";
|
||||
echo '[data:'.$params['message_id']."]\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
// 继续运行脚本
|
||||
self::SyncJobSend($message['id'], 'message_id', 'MessageSend');
|
||||
self::SyncJobSend($data['id'], 'message_id', 'MessageSend');
|
||||
|
||||
// end
|
||||
die('[end_time:'.date('Y-m-d H:i:s')."][msg:处理结束]\n\n");
|
||||
@ -609,7 +609,12 @@ class AlipayLifeService
|
||||
*/
|
||||
public static function AlipayLifeSearch($params = [])
|
||||
{
|
||||
$where = ['l.is_shelves'=>1];
|
||||
if(isset($params['is_all']) && $params['is_all'] == 1)
|
||||
{
|
||||
$where = [];
|
||||
} else {
|
||||
$where = ['l.is_shelves'=>1];
|
||||
}
|
||||
|
||||
// 分类
|
||||
if(!empty($params['category_id']))
|
||||
@ -1006,28 +1011,28 @@ class AlipayLifeService
|
||||
return DataReturn($ret, -1);
|
||||
}
|
||||
|
||||
// 获取消息
|
||||
// 获取数据
|
||||
$m = M('AlipayLifeMenu');
|
||||
$menu = $m->find(intval($params['id']));
|
||||
if(empty($menu))
|
||||
$data = $m->find(intval($params['id']));
|
||||
if(empty($data))
|
||||
{
|
||||
return DataReturn('菜单纪录不存在', -1);
|
||||
return DataReturn('菜单记录不存在', -1);
|
||||
}
|
||||
$common_release_status_list = L('common_release_status_list');
|
||||
if(!in_array($menu['status'], [0,4]))
|
||||
if(!in_array($data['status'], [0,4]))
|
||||
{
|
||||
return DataReturn('状态不可操作['.$common_release_status_list[$menu['status']]['name'].']', -2);
|
||||
return DataReturn('状态不可操作['.$common_release_status_list[$data['status']]['name'].']', -2);
|
||||
}
|
||||
|
||||
// 获取消息内容
|
||||
$content_list = M('AlipayLifeMenuContent')->field('id,name')->where(['alipay_life_menu_id'=>$menu['id'], 'pid'=>0])->select();
|
||||
// 获取数据内容
|
||||
$content_list = M('AlipayLifeMenuContent')->field('id,name')->where(['alipay_life_menu_id'=>$data['id'], 'pid'=>0])->select();
|
||||
if(empty($content_list))
|
||||
{
|
||||
return DataReturn('菜单数据不能为空', -1);
|
||||
}
|
||||
|
||||
$content_count = count($content_list);
|
||||
switch($menu['type'])
|
||||
switch($data['type'])
|
||||
{
|
||||
case 0 :
|
||||
if($content_count > 4)
|
||||
@ -1055,31 +1060,31 @@ class AlipayLifeService
|
||||
}
|
||||
|
||||
// 生活号
|
||||
$data = [];
|
||||
$alipay_life_all = json_decode($menu['alipay_life_ids'], true);
|
||||
$detail = [];
|
||||
$alipay_life_all = json_decode($data['alipay_life_ids'], true);
|
||||
foreach($alipay_life_all as $alipay_life_id)
|
||||
{
|
||||
$data[] = [
|
||||
'alipay_life_id' => $alipay_life_id,
|
||||
'alipay_life_menu_id' => $menu['id'],
|
||||
'add_time' => time(),
|
||||
$detail[] = [
|
||||
'alipay_life_id' => $alipay_life_id,
|
||||
'alipay_life_menu_id' => $data['id'],
|
||||
'add_time' => time(),
|
||||
];
|
||||
}
|
||||
|
||||
// 入库详情表
|
||||
$m->startTrans();
|
||||
if(M('AlipayLifeMenuDetail')->addAll($data) !== false)
|
||||
if(M('AlipayLifeMenuDetail')->addAll($detail) !== false)
|
||||
{
|
||||
$menu_data = [
|
||||
$upd_data = [
|
||||
'status' => 1,
|
||||
'startup_time' => time(),
|
||||
'upd_time' => time()
|
||||
];
|
||||
$status = M('AlipayLifeMenu')->where(['id'=>$menu['id']])->save($menu_data);
|
||||
$status = M('AlipayLifeMenu')->where(['id'=>$data['id']])->save($upd_data);
|
||||
if($status !== false)
|
||||
{
|
||||
$m->commit();
|
||||
self::SyncJobSend($menu['id'], 'menu_id', 'MenuRelease');
|
||||
self::SyncJobSend($data['id'], 'menu_id', 'MenuRelease');
|
||||
return DataReturn(L('common_submit_success'), 0);
|
||||
}
|
||||
}
|
||||
@ -1105,40 +1110,40 @@ class AlipayLifeService
|
||||
|
||||
// 启动开始
|
||||
echo '[start_time:'.date('Y-m-d H:i:s')."]\n";
|
||||
echo '[menu:'.$params['menu_id']."]\n";
|
||||
echo '[data:'.$params['menu_id']."]\n";
|
||||
|
||||
// 开始处理
|
||||
$m = M('AlipayLifeMenu');
|
||||
$menu = $m->find($params['menu_id']);
|
||||
if(empty($menu))
|
||||
$data = $m->find($params['menu_id']);
|
||||
if(empty($data))
|
||||
{
|
||||
die('[time:'.date('Y-m-d H:i:s')."][msg:{$params['menu_id']}数据不存在]\n\n");
|
||||
}
|
||||
if(!in_array($menu['status'], [1]))
|
||||
if(!in_array($data['status'], [1]))
|
||||
{
|
||||
die('[time:'.date('Y-m-d H:i:s')."][msg:{$menu['status']}状态不可操作]\n\n");
|
||||
die('[time:'.date('Y-m-d H:i:s')."][msg:{$data['status']}状态不可操作]\n\n");
|
||||
}
|
||||
|
||||
// 生活号
|
||||
$alipay_life_all = json_decode($menu['alipay_life_ids'], true);
|
||||
$alipay_life_all = json_decode($data['alipay_life_ids'], true);
|
||||
|
||||
// 消息内容
|
||||
$field = 'id,pid,name,action_type,action_value,out_icon';
|
||||
$menu['content'] = M('AlipayLifeMenuContent')->field($field)->where(['alipay_life_menu_id'=>$menu['id'], 'pid'=>0])->order('sort asc')->select();
|
||||
if(empty($menu['content']))
|
||||
$data['content'] = M('AlipayLifeMenuContent')->field($field)->where(['alipay_life_menu_id'=>$data['id'], 'pid'=>0])->order('sort asc')->select();
|
||||
if(empty($data['content']))
|
||||
{
|
||||
die('[time:'.date('Y-m-d H:i:s')."][msg:{$menu['id']}菜单内容为空]\n\n");
|
||||
die('[time:'.date('Y-m-d H:i:s')."][msg:{$data['id']}菜单内容为空]\n\n");
|
||||
}
|
||||
|
||||
// 是否文本类型
|
||||
$action_type_list = L('common_alipay_life_menu_action_type_list');
|
||||
foreach($menu['content'] as &$v)
|
||||
foreach($data['content'] as &$v)
|
||||
{
|
||||
// 外部事件值
|
||||
$v['action_type'] = $action_type_list[$v['action_type']]['out_value'];
|
||||
|
||||
// 是否需要读取子集
|
||||
if($menu['type'] == 0)
|
||||
if($data['type'] == 0)
|
||||
{
|
||||
$items = M('AlipayLifeMenuContent')->field($field)->where(['pid'=>$v['id']])->order('sort asc')->select();
|
||||
if(!empty($items))
|
||||
@ -1155,7 +1160,7 @@ class AlipayLifeService
|
||||
|
||||
// 生活号循环处理
|
||||
$detail_m = M('AlipayLifeMenuDetail');
|
||||
$detail = $detail_m->where(['alipay_life_menu_id'=>$menu['id'], 'status'=>0])->select();
|
||||
$detail = $detail_m->where(['alipay_life_menu_id'=>$data['id'], 'status'=>0])->limit(10)->select();
|
||||
if(!empty($detail))
|
||||
{
|
||||
foreach($detail as $d)
|
||||
@ -1165,27 +1170,27 @@ class AlipayLifeService
|
||||
|
||||
// 请求接口处理
|
||||
$obj = new \Library\AlipayLife(['life_data'=>$life]);
|
||||
$ret = $obj->MenuRelease($menu);
|
||||
$ret = $obj->MenuRelease($data);
|
||||
|
||||
// 返回状态更新
|
||||
$status = (isset($ret['status']) && $ret['status'] == 0) ? 2 : 4;
|
||||
$detail_m->where(['id'=>$d['id']])->save(['status'=>$status, 'send_time'=>time(), 'upd_time'=>time(), 'return_msg'=>$ret['msg']]);
|
||||
}
|
||||
} else {
|
||||
$status_all = $detail_m->where(['alipay_life_menu_id'=>$menu['id']])->group('status')->getField('status', true);
|
||||
$status_all = $detail_m->where(['alipay_life_menu_id'=>$data['id']])->group('status')->getField('status', true);
|
||||
if(count($status_all) <= 1)
|
||||
{
|
||||
$status = in_array(2, $status_all) ? 2 : 4;
|
||||
} else {
|
||||
$status = 3;
|
||||
}
|
||||
$m->where(['id'=>$menu['id']])->save(['success_time'=>time(), 'status'=>$status, 'upd_time'=>time()]);
|
||||
$m->where(['id'=>$data['id']])->save(['success_time'=>time(), 'status'=>$status, 'upd_time'=>time()]);
|
||||
echo '[success_time:'.date('Y-m-d H:i:s')."]\n";
|
||||
echo '[menu:'.$params['menu_id']."]\n\n";
|
||||
echo '[data:'.$params['menu_id']."]\n\n";
|
||||
}
|
||||
|
||||
// 继续运行脚本
|
||||
self::SyncJobSend($menu['id'], 'menu_id', 'MenuRelease');
|
||||
self::SyncJobSend($data['id'], 'menu_id', 'MenuRelease');
|
||||
|
||||
// end
|
||||
die('[end_time:'.date('Y-m-d H:i:s')."][msg:处理结束]\n\n");
|
||||
@ -1232,5 +1237,281 @@ class AlipayLifeService
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量上下架保存
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-10-24
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function LifeStatusSave($params = [])
|
||||
{
|
||||
// 参数校验
|
||||
$p = [
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'name',
|
||||
'error_msg' => '名称不能为空',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'length',
|
||||
'key_name' => 'name',
|
||||
'checked_data' => '30',
|
||||
'error_msg' => '名称最多30个字符',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'in',
|
||||
'key_name' => 'is_shelves',
|
||||
'checked_data' => [0,1],
|
||||
'error_msg' => '上下架状态选择有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'alipay_life_ids',
|
||||
'error_msg' => '请选择生活号',
|
||||
],
|
||||
];
|
||||
$ret = params_checked($params, $p);
|
||||
if($ret !== true)
|
||||
{
|
||||
return DataReturn($ret, -1);
|
||||
}
|
||||
|
||||
// 数据项
|
||||
$data = [
|
||||
'name' => I('name', '', '', $params),
|
||||
'is_shelves' => intval($params['is_shelves']),
|
||||
'alipay_life_ids' => empty($params['alipay_life_ids']) ? 0 : json_encode(explode(',', $params['alipay_life_ids'])),
|
||||
];
|
||||
|
||||
// 开始处理业务
|
||||
$status = false;
|
||||
$m = M('AlipayLifeStatus');
|
||||
if(empty($params['id']))
|
||||
{
|
||||
$data['add_time'] = time();
|
||||
if($m->add($data))
|
||||
{
|
||||
$status = true;
|
||||
$msg = L('common_operation_add_success');
|
||||
} else {
|
||||
$msg = L('common_operation_add_error');
|
||||
}
|
||||
} else {
|
||||
$data['upd_time'] = time();
|
||||
if($m->where(array('id'=>intval(I('id'))))->save($data))
|
||||
{
|
||||
$status = true;
|
||||
$msg = L('common_operation_edit_success');
|
||||
} else {
|
||||
$msg = L('common_operation_edit_error');
|
||||
}
|
||||
}
|
||||
|
||||
return DataReturn($msg, $status ? 0 : -100);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量上下架提交
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-10-24
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function LifeStatusSubmit($params = [])
|
||||
{
|
||||
// 基础参数
|
||||
$p = [
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'id',
|
||||
'error_msg' => '菜单id有误',
|
||||
],
|
||||
];
|
||||
$ret = params_checked($params, $p);
|
||||
if($ret !== true)
|
||||
{
|
||||
return DataReturn($ret, -1);
|
||||
}
|
||||
|
||||
// 获取数据
|
||||
$m = M('AlipayLifeStatus');
|
||||
$data = $m->find(intval($params['id']));
|
||||
if(empty($data))
|
||||
{
|
||||
return DataReturn('数据不存在', -1);
|
||||
}
|
||||
$common_handle_status_list = L('common_handle_status_list');
|
||||
if(!in_array($data['status'], [0,4]))
|
||||
{
|
||||
return DataReturn('状态不可操作['.$common_handle_status_list[$data['status']]['name'].']', -2);
|
||||
}
|
||||
|
||||
// 生活号
|
||||
$detail = [];
|
||||
$alipay_life_all = json_decode($data['alipay_life_ids'], true);
|
||||
foreach($alipay_life_all as $alipay_life_id)
|
||||
{
|
||||
$detail[] = [
|
||||
'alipay_life_id' => $alipay_life_id,
|
||||
'alipay_life_status_id' => $data['id'],
|
||||
'add_time' => time(),
|
||||
];
|
||||
}
|
||||
|
||||
// 入库详情表
|
||||
$m->startTrans();
|
||||
if(M('AlipayLifeStatusDetail')->addAll($detail) !== false)
|
||||
{
|
||||
$upd_data = [
|
||||
'status' => 1,
|
||||
'startup_time' => time(),
|
||||
'upd_time' => time()
|
||||
];
|
||||
$status = $m->where(['id'=>$data['id']])->save($upd_data);
|
||||
if($status !== false)
|
||||
{
|
||||
$m->commit();
|
||||
self::SyncJobSend($data['id'], 'status_id', 'StatusHandle');
|
||||
return DataReturn(L('common_submit_success'), 0);
|
||||
}
|
||||
}
|
||||
$m->rollback();
|
||||
return DataReturn(L('common_submit_error'), -100);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量上下架处理
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-10-24
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function StatusHandle($params = [])
|
||||
{
|
||||
if(empty($params['status_id']))
|
||||
{
|
||||
die('[params_time:'.date('Y-m-d H:i:s')."][msg:id有误]\n\n");
|
||||
}
|
||||
|
||||
// 启动开始
|
||||
echo '[start_time:'.date('Y-m-d H:i:s')."]\n";
|
||||
echo '[menu:'.$params['status_id']."]\n";
|
||||
|
||||
// 开始处理
|
||||
$m = M('AlipayLifeStatus');
|
||||
$data = $m->find($params['status_id']);
|
||||
if(empty($data))
|
||||
{
|
||||
die('[time:'.date('Y-m-d H:i:s')."][msg:{$params['status_id']}数据不存在]\n\n");
|
||||
}
|
||||
if(!in_array($data['status'], [1]))
|
||||
{
|
||||
die('[time:'.date('Y-m-d H:i:s')."][msg:{$data['status']}状态不可操作]\n\n");
|
||||
}
|
||||
|
||||
// 生活号循环处理
|
||||
$detail_m = M('AlipayLifeStatusDetail');
|
||||
$detail = $detail_m->where(['alipay_life_status_id'=>$data['id'], 'status'=>0])->limit(10)->select();
|
||||
$life_m = M('AlipayLife');
|
||||
if(!empty($detail))
|
||||
{
|
||||
foreach($detail as $v)
|
||||
{
|
||||
// 数据更新
|
||||
$status = 4;
|
||||
$msg = '';
|
||||
$life_m->startTrans();
|
||||
if($life_m->where(array('id'=>$v['alipay_life_id']))->save(array('is_shelves'=>$data['is_shelves'], 'upd_time'=>time())))
|
||||
{
|
||||
$obj = new \Library\AlipayLife(['life_data'=>$life_m->find($v['alipay_life_id'])]);
|
||||
if($data['is_shelves'] == 1)
|
||||
{
|
||||
$ret = $obj->LifeAboard();
|
||||
} else {
|
||||
$ret = $obj->LifeDebark();
|
||||
}
|
||||
if($ret['status'] == 0)
|
||||
{
|
||||
$life_m->commit();
|
||||
$status = 2;
|
||||
} else {
|
||||
$life_m->rollback();
|
||||
}
|
||||
$msg = $ret['msg'];
|
||||
} else {
|
||||
$life_m->rollback();
|
||||
$msg = '主数据更新失败';
|
||||
}
|
||||
$detail_m->where(['id'=>$v['id']])->save(['status'=>$status, 'send_time'=>time(), 'upd_time'=>time(), 'return_msg'=>$msg]);
|
||||
}
|
||||
} else {
|
||||
$status_all = $detail_m->where(['alipay_life_status_id'=>$data['id']])->group('status')->getField('status', true);
|
||||
if(count($status_all) <= 1)
|
||||
{
|
||||
$status = in_array(2, $status_all) ? 2 : 4;
|
||||
} else {
|
||||
$status = 3;
|
||||
}
|
||||
$m->where(['id'=>$data['id']])->save(['success_time'=>time(), 'status'=>$status, 'upd_time'=>time()]);
|
||||
echo '[success_time:'.date('Y-m-d H:i:s')."]\n";
|
||||
echo '[data:'.$params['status_id']."]\n\n";
|
||||
}
|
||||
|
||||
// 继续运行脚本
|
||||
self::SyncJobSend($data['id'], 'status_id', 'StatusHandle');
|
||||
|
||||
// end
|
||||
die('[end_time:'.date('Y-m-d H:i:s')."][msg:处理结束]\n\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量上下架详情列表
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-10-30
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function StatusDetailList($params = [])
|
||||
{
|
||||
// 基础参数
|
||||
if(empty($params['status_id']))
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
// 条件
|
||||
$where = ['alipay_life_status_id' => intval($params['status_id'])];
|
||||
|
||||
// 列表
|
||||
$data = M('AlipayLifeStatusDetail')->where($where)->order('id desc')->select();
|
||||
if(!empty($data))
|
||||
{
|
||||
$common_handle_status_list = L('common_handle_status_list');
|
||||
foreach($data as &$v)
|
||||
{
|
||||
// 状态
|
||||
$v['status_name'] = $common_handle_status_list[$v['status']]['name'];
|
||||
|
||||
// 生活号
|
||||
$v['alipay_life_name'] = empty($v['alipay_life_id']) ? '' : M('AlipayLife')->where(['id'=>$v['alipay_life_id']])->getField('name');
|
||||
|
||||
// 时间
|
||||
$v['add_time'] = date('Y-m-d H:i:s', $v['add_time']);
|
||||
$v['upd_time'] = empty($v['upd_time']) ? '' : date('Y-m-d H:i:s', $v['upd_time']);
|
||||
$v['send_time'] = empty($v['send_time']) ? '' : date('Y-m-d H:i:s', $v['send_time']);
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
?>
|
||||
93
service/Public/Admin/Default/Css/AlipayLifeStatus.css
Executable file
93
service/Public/Admin/Default/Css/AlipayLifeStatus.css
Executable file
@ -0,0 +1,93 @@
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
.form-keyword { width: 55% !important; display: initial !important; }
|
||||
.more-submit input { display: none; }
|
||||
.param-where, .param-date input { display: initial !important; }
|
||||
.alipay-life-row { width: 30%; }
|
||||
@media only screen and (max-width: 641px) {
|
||||
.param-where { width: 100% !important; margin-left: 0px !important; }
|
||||
.param-date input { width: 47% !important; }
|
||||
}
|
||||
@media only screen and (min-width: 641px) {
|
||||
.param-where { width: 32% !important; float: left; }
|
||||
.param-date input { width: 45% !important; }
|
||||
.param-where:nth-child(1), .param-where:nth-child(4) { margin-left: 0px !important; }
|
||||
}
|
||||
@media only screen and (max-width: 321px) {
|
||||
.view-operation button { margin: 2px 0px; }
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
.life-container .life-form-category, .life-container .chosen-container, .life-container .life-form-keywords {
|
||||
width: 30% !important;
|
||||
}
|
||||
.life-container .chosen-container, .life-container .life-form-keywords {
|
||||
display: -webkit-inline-box !important;
|
||||
}
|
||||
.life-container .chosen-single {
|
||||
width: 100%;
|
||||
}
|
||||
.life-container .life-form {
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
.life-list {
|
||||
overflow: hidden;
|
||||
margin-bottom: 20px;
|
||||
position: relative;
|
||||
}
|
||||
.life-list .life-items {
|
||||
width: calc(50% - 50px);
|
||||
height: 300px;
|
||||
}
|
||||
.life-list .life-items .title {
|
||||
text-align: center;
|
||||
}
|
||||
.life-list .life-items .life-content {
|
||||
border: 1px solid #eee;
|
||||
height: calc(100% - 25px);
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.life-list .life-items .life-content li {
|
||||
padding: 5px;
|
||||
border-style: dotted;
|
||||
border-color: #eaeaea;
|
||||
border-width: 1px 0;
|
||||
}
|
||||
.life-list .life-items .life-content li:nth-child(2) {
|
||||
border-top: 0;
|
||||
}
|
||||
.life-list .life-items .life-content li i {
|
||||
cursor: pointer;
|
||||
padding: 0 10px 0 5px;
|
||||
}
|
||||
.life-list .selected-all {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: calc(50% - 30px);
|
||||
}
|
||||
.life-container input[name="alipay_life_ids"] {
|
||||
position: absolute;
|
||||
left: -1000000px;
|
||||
top: -1000000px;
|
||||
}
|
||||
.life-list i {
|
||||
color: #888 !important;
|
||||
}
|
||||
.am-form-error .life-items .life-content {
|
||||
border-color: #dd514c;
|
||||
}
|
||||
@media only screen and (max-width: 641px) {
|
||||
.life-container .life-form-category, .life-container .life-form-keywords
|
||||
{
|
||||
width: calc(55% - 60px) !important;
|
||||
display: -webkit-inline-box !important;
|
||||
}
|
||||
.life-container .chosen-container {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
107
service/Public/Admin/Default/Js/AlipayLifeStatus.js
Executable file
107
service/Public/Admin/Default/Js/AlipayLifeStatus.js
Executable file
@ -0,0 +1,107 @@
|
||||
$(function()
|
||||
{
|
||||
// 添加元素到右侧
|
||||
function RightElementAdd(value, name)
|
||||
{
|
||||
if($('ul.ul-right').find('.items-li-'+value).length == 0)
|
||||
{
|
||||
var html = '<li class="am-animation-slide-bottom items-li-'+value+'"><span class="name" data-value="'+value+'">'+name+'</span><i class="am-icon-trash-o am-fr"></i></li>';
|
||||
$('ul.ul-right').append(html);
|
||||
}
|
||||
|
||||
// 右侧数据同步
|
||||
RightElementAlipayLife();
|
||||
|
||||
// 左侧是否还有内容
|
||||
if($('ul.ul-left li').length == 0)
|
||||
{
|
||||
$('ul.ul-left .table-no').removeClass('none');
|
||||
} else {
|
||||
$('ul.ul-left .table-no').addClass('none');
|
||||
}
|
||||
}
|
||||
|
||||
// 批量-生活号id同步
|
||||
function RightElementAlipayLife()
|
||||
{
|
||||
var value_all = [];
|
||||
$('ul.ul-right li').each(function(k, v)
|
||||
{
|
||||
value_all[k] = $(this).find('span.name').data('value');
|
||||
});
|
||||
$('.life-container input[name="alipay_life_ids"]').val(value_all.join(',')).blur();
|
||||
|
||||
// 右侧是否还有数据
|
||||
if($('ul.ul-right li').length == 0)
|
||||
{
|
||||
$('ul.ul-right .table-no').removeClass('none');
|
||||
} else {
|
||||
$('ul.ul-right .table-no').addClass('none');
|
||||
}
|
||||
}
|
||||
// 左侧点击到右侧
|
||||
$('ul.ul-left').on('click', 'i.am-icon-angle-right', function()
|
||||
{
|
||||
var value = $(this).prev().data('value');
|
||||
var name = $(this).prev().text();
|
||||
$(this).parent().remove();
|
||||
RightElementAdd(value, name);
|
||||
});
|
||||
|
||||
// 左侧全部移动到右侧
|
||||
$('.selected-all').on('click', function()
|
||||
{
|
||||
$('ul.ul-left li').each(function(k, v)
|
||||
{
|
||||
var value = $(this).find('span.name').data('value');
|
||||
var name = $(this).find('span.name').text();
|
||||
$(this).remove();
|
||||
RightElementAdd(value, name);
|
||||
});
|
||||
});
|
||||
|
||||
// 右侧删除
|
||||
$('ul.ul-right').on('click', 'i.am-icon-trash-o', function()
|
||||
{
|
||||
$(this).parent().remove();
|
||||
RightElementAlipayLife();
|
||||
});
|
||||
|
||||
// 生活号搜索
|
||||
$('.life-form .search-submit').on('click', function()
|
||||
{
|
||||
var category_id = $('.life-form .life-form-category').val();
|
||||
var keywords = $('.life-form .life-form-keywords').val();
|
||||
console.log(category_id, keywords)
|
||||
|
||||
// ajax请求
|
||||
$.ajax({
|
||||
url:$('.life-form').data('search-url'),
|
||||
type:'POST',
|
||||
dataType:"json",
|
||||
timeout:10000,
|
||||
data:{"category_id": category_id, "keywords": keywords},
|
||||
success:function(result)
|
||||
{
|
||||
if(result.code == 0)
|
||||
{
|
||||
var html = '';
|
||||
for(var i in result.data)
|
||||
{
|
||||
html += '<li class="am-animation-slide-bottom"><span class="name" data-value="'+result['data'][i]['id']+'">'+result['data'][i]['name']+'</span><i class="am-icon-angle-right am-fr"></i></li>';
|
||||
}
|
||||
$('ul.ul-left .table-no').addClass('none');
|
||||
$('ul.ul-left li').remove();
|
||||
$('ul.ul-left').append(html);
|
||||
} else {
|
||||
Prompt(result.msg);
|
||||
}
|
||||
},
|
||||
error:function()
|
||||
{
|
||||
Prompt('网络异常错误');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user