发送单消息成功
parent
9f310f801d
commit
7ca13df86f
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Admin\Controller;
|
||||
|
||||
use Service\AlipayLifeService;
|
||||
|
||||
/**
|
||||
* 生活号消息管理
|
||||
* @author Devil
|
||||
|
|
@ -52,14 +54,14 @@ class AlipayLifeMessageController extends CommonController
|
|||
$number = MyC('admin_page_number');
|
||||
$page_param = array(
|
||||
'number' => $number,
|
||||
'total' => $m->alias('a')->join('INNER JOIN __ALIPAY_LIFE_CATEGORY_JOIN__ AS cj ON a.id=cj.alipay_life_id')->where($where)->count('DISTINCT a.id'),
|
||||
'total' => $m->where($where)->count(),
|
||||
'where' => $param,
|
||||
'url' => U('Admin/AlipayLifeMessage/Index'),
|
||||
);
|
||||
$page = new \Library\Page($page_param);
|
||||
|
||||
// 获取列表
|
||||
$list = $m->alias('a')->field('a.*')->join('INNER JOIN __ALIPAY_LIFE_CATEGORY_JOIN__ AS cj ON a.id=cj.alipay_life_id')->where($where)->limit($page->GetPageStarNumber(), $number)->order('a.id desc')->group('a.id')->select();
|
||||
$list = $m->where($where)->limit($page->GetPageStarNumber(), $number)->order('id desc')->select();
|
||||
$list = $this->SetDataHandle($list);
|
||||
|
||||
// 参数
|
||||
|
|
@ -71,9 +73,11 @@ class AlipayLifeMessageController extends CommonController
|
|||
// 发送状态
|
||||
$this->assign('common_send_status_list', L('common_send_status_list'));
|
||||
|
||||
// 生活号消息分类
|
||||
$alipay_life_list = M('AlipayLife')->field('id,name')->select();
|
||||
$this->assign('alipay_life_list', $alipay_life_list);
|
||||
// 消息类型
|
||||
$this->assign('alipay_life_message_type_list', L('alipay_life_message_type_list'));
|
||||
|
||||
// 发送类型
|
||||
$this->assign('alipay_life_message_send_type_list', L('alipay_life_message_send_type_list'));
|
||||
|
||||
// 数据列表
|
||||
$this->assign('list', $list);
|
||||
|
|
@ -93,21 +97,38 @@ class AlipayLifeMessageController extends CommonController
|
|||
{
|
||||
if(!empty($data))
|
||||
{
|
||||
$common_is_enable_tips = L('common_is_enable_tips');
|
||||
$common_send_status_list = L('common_send_status_list');
|
||||
$alipay_life_message_type_list = L('alipay_life_message_type_list');
|
||||
$alipay_life_message_send_type_list = L('alipay_life_message_send_type_list');
|
||||
foreach($data as &$v)
|
||||
{
|
||||
// 状态
|
||||
$v['status_name'] = $common_send_status_list[$v['status']]['name'];
|
||||
|
||||
// 消息类型
|
||||
$v['type_name'] = $alipay_life_message_type_list[$v['type']]['name'];
|
||||
|
||||
// 发送状态
|
||||
$v['send_type_name'] = $alipay_life_message_send_type_list[$v['send_type']]['name'];
|
||||
|
||||
// 分类名称
|
||||
$category_all = M('AlipayLifeMessageCategoryJoin')->where(['alipay_life_id'=>$v['id']])->getField('alipay_life_category_id', true);
|
||||
$v['alipay_life_category_text'] = M('AlipayLifeMessageCategory')->where(['id'=>['in', $category_all]])->getField('name', true);
|
||||
|
||||
// logo
|
||||
$v['logo'] = empty($v['logo']) ? '' : C('IMAGE_HOST').$v['logo'];
|
||||
// image_url
|
||||
$v['image_url'] = empty($v['image_url']) ? '' : C('IMAGE_HOST').$v['image_url'];
|
||||
|
||||
// 添加时间
|
||||
$v['add_time_text'] = date('Y-m-d H:i:s', $v['add_time']);
|
||||
// 生活号分类
|
||||
$v['category_all'] = empty($v['alipay_life_category_id']) ? '' : M('AlipayLifeCategory')->where(['id'=>['in', json_decode($v['alipay_life_category_id'], true)]])->getField('name', true);
|
||||
|
||||
// 更新时间
|
||||
$v['upd_time_text'] = date('Y-m-d H:i:s', $v['upd_time']);
|
||||
// 生活号
|
||||
$v['alipay_life_name'] = empty($v['alipay_life_id']) ? '' : M('AlipayLife')->where(['id'=>$v['alipay_life_id']])->getField('name');
|
||||
|
||||
// 时间
|
||||
$v['send_startup_time'] = empty($v['send_startup_time']) ? '' : date('Y-m-d H:i:s', $v['send_startup_time']);
|
||||
$v['send_success_time'] = empty($v['send_success_time']) ? '' : date('Y-m-d H:i:s', $v['send_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;
|
||||
|
|
@ -127,42 +148,46 @@ class AlipayLifeMessageController extends CommonController
|
|||
// 模糊
|
||||
if(!empty($_REQUEST['keyword']))
|
||||
{
|
||||
$where['a.name'] = array('like', '%'.I('keyword').'%');
|
||||
$where['title'] = array('like', '%'.I('keyword').'%');
|
||||
}
|
||||
|
||||
// 是否更多条件
|
||||
if(I('is_more', 0) == 1)
|
||||
{
|
||||
if(I('is_shelves', -1) > -1)
|
||||
if(I('status', -1) > -1)
|
||||
{
|
||||
$where['a.is_shelves'] = intval(I('is_shelves', 0));
|
||||
$where['status'] = intval(I('status', 0));
|
||||
}
|
||||
if(I('alipay_life_category_id', -1) > -1)
|
||||
if(I('type', -1) > -1)
|
||||
{
|
||||
$where['cj.alipay_life_category_id'] = intval(I('alipay_life_category_id', 0));
|
||||
$where['type'] = intval(I('type', 0));
|
||||
}
|
||||
if(I('send_type', -1) > -1)
|
||||
{
|
||||
$where['send_type'] = intval(I('send_type', 0));
|
||||
}
|
||||
|
||||
// 表达式
|
||||
if(!empty($_REQUEST['time_start']))
|
||||
{
|
||||
$where['a.add_time'][] = array('gt', strtotime(I('time_start')));
|
||||
$where['add_time'][] = array('gt', strtotime(I('time_start')));
|
||||
}
|
||||
if(!empty($_REQUEST['time_end']))
|
||||
{
|
||||
$where['a.add_time'][] = array('lt', strtotime(I('time_end')));
|
||||
$where['add_time'][] = array('lt', strtotime(I('time_end')));
|
||||
}
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
|
||||
/**
|
||||
* [SendInfo 添加/编辑页面]
|
||||
* [SaveInfo 添加/编辑页面]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-14T21:37:02+0800
|
||||
*/
|
||||
public function SendInfo()
|
||||
public function SaveInfo()
|
||||
{
|
||||
// 轮播图片信息
|
||||
$data = empty($_REQUEST['id']) ? array() : M('AlipayLifeMessage')->find(I('id'));
|
||||
|
|
@ -203,7 +228,7 @@ class AlipayLifeMessageController extends CommonController
|
|||
// 参数
|
||||
$this->assign('params', array_merge($_POST, $_GET));
|
||||
$this->assign('nav_type', I('nav_type', 0));
|
||||
$this->display('SendInfo');
|
||||
$this->display('SaveInfo');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -221,95 +246,8 @@ class AlipayLifeMessageController extends CommonController
|
|||
$this->error(L('common_unauthorized_access'));
|
||||
}
|
||||
|
||||
// 图片
|
||||
$this->ImagesSave('logo', 'file_logo', 'alipay_life');
|
||||
|
||||
// id为空则表示是新增
|
||||
$m = D('AlipayLifeMessage');
|
||||
|
||||
// 公共额外数据处理
|
||||
$_POST['is_shelves'] = intval(I('is_shelves', 0));
|
||||
|
||||
// 开启事务
|
||||
$m->startTrans();
|
||||
|
||||
// 分类
|
||||
$category_m = M('AlipayLifeMessageCategoryJoin');
|
||||
if(empty($_POST['id']))
|
||||
{
|
||||
$type = 1;
|
||||
} else {
|
||||
$type = 2;
|
||||
$category_m->where(['id'=>I('id')])->delete();
|
||||
}
|
||||
|
||||
$status = false;
|
||||
$msg = '';
|
||||
$alipay_life_id = I('id', 0);
|
||||
if($m->create($_POST, $type))
|
||||
{
|
||||
// 额外数据处理
|
||||
$m->upd_time = time();
|
||||
$m->name = I('name');
|
||||
$m->appid = I('appid');
|
||||
$m->rsa_public = I('rsa_public');
|
||||
$m->rsa_private = I('rsa_private');
|
||||
$m->out_rsa_public = I('out_rsa_public');
|
||||
|
||||
if($type == 1)
|
||||
{
|
||||
// 写入数据库
|
||||
$m->add_time = time();
|
||||
$alipay_life_id = $m->add();
|
||||
if($alipay_life_id)
|
||||
{
|
||||
$status = true;
|
||||
$msg = L('common_operation_add_success');
|
||||
} else {
|
||||
$msg = L('common_operation_add_error');
|
||||
}
|
||||
} else {
|
||||
// 更新数据库
|
||||
if($m->where(array('id'=>$alipay_life_id))->save())
|
||||
{
|
||||
$status = true;
|
||||
$msg = L('common_operation_edit_success');
|
||||
} else {
|
||||
$msg = L('common_operation_edit_error');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$msg = $m->getError();
|
||||
}
|
||||
|
||||
// 分类处理
|
||||
if($status === true)
|
||||
{
|
||||
$count = 0;
|
||||
$all = explode(',', I('alipay_life_category_id'));
|
||||
foreach($all as $v)
|
||||
{
|
||||
if($category_m->add(['alipay_life_id'=>$alipay_life_id, 'alipay_life_category_id'=>$v, 'add_time'=>time()]))
|
||||
{
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
if($count < count($all))
|
||||
{
|
||||
// 回滚事务
|
||||
$m->rollback();
|
||||
|
||||
$this->ajaxReturn(L('alipay_life_save_category_error'), -10);
|
||||
}
|
||||
} else {
|
||||
// 回滚事务
|
||||
$m->rollback();
|
||||
$this->ajaxReturn($msg, -100);
|
||||
}
|
||||
|
||||
// 回滚事务
|
||||
$m->commit();
|
||||
$this->ajaxReturn($msg, 0);
|
||||
$ret = AlipayLifeService::MessageAdd($_POST);
|
||||
$this->ajaxReturn($ret['msg'], $ret['code'], $ret['data']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -321,50 +259,39 @@ class AlipayLifeMessageController extends CommonController
|
|||
*/
|
||||
public function Delete()
|
||||
{
|
||||
// 是否ajax请求
|
||||
if(!IS_AJAX)
|
||||
{
|
||||
$this->error(L('common_unauthorized_access'));
|
||||
}
|
||||
|
||||
$m = D('AlipayLifeMessage');
|
||||
if($m->create($_POST, 5))
|
||||
// 删除
|
||||
if(M('AlipayLifeMessage')->delete(intval(I('id'))))
|
||||
{
|
||||
$id = I('id');
|
||||
|
||||
// 删除
|
||||
if($m->delete($id))
|
||||
{
|
||||
$this->ajaxReturn(L('common_operation_delete_success'));
|
||||
} else {
|
||||
$this->ajaxReturn(L('common_operation_delete_error'), -100);
|
||||
}
|
||||
$this->ajaxReturn(L('common_operation_delete_success'));
|
||||
} else {
|
||||
$this->ajaxReturn($m->getError(), -1);
|
||||
$this->ajaxReturn(L('common_operation_delete_error'), -100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* [StatusUpdate 状态更新]
|
||||
* 发送消息
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2017-01-12T22:23:06+0800
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-10-24
|
||||
* @desc description
|
||||
*/
|
||||
public function StatusUpdate()
|
||||
public function Send()
|
||||
{
|
||||
// 参数
|
||||
if(empty($_POST['id']) || !isset($_POST['state']))
|
||||
// 是否ajax请求
|
||||
if(!IS_AJAX)
|
||||
{
|
||||
$this->ajaxReturn(L('common_param_error'), -1);
|
||||
$this->error(L('common_unauthorized_access'));
|
||||
}
|
||||
|
||||
// 数据更新
|
||||
if(M('AlipayLifeMessage')->where(array('id'=>I('id')))->save(array('is_shelves'=>I('state'))))
|
||||
{
|
||||
$this->ajaxReturn(L('common_operation_edit_success'));
|
||||
} else {
|
||||
$this->ajaxReturn(L('common_operation_edit_error'), -100);
|
||||
}
|
||||
$ret = AlipayLifeService::MessageSubmit($_POST);
|
||||
$this->ajaxReturn($ret['msg'], $ret['code'], $ret['data']);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -59,7 +59,7 @@ class AlipayLifeUserController extends CommonController
|
|||
$page = new \Library\Page($page_param);
|
||||
|
||||
// 获取列表
|
||||
$field = 'u.*, au.alipay_life_id, au.id AS alipay_life_user_id, au.user_id';
|
||||
$field = 'u.*, au.alipay_life_id, au.id AS alipay_life_user_id, au.user_id, au.add_time AS alipay_life_add_time';
|
||||
$list = $this->SetDataHandle($m->alias('au')->where($where)->join('INNER JOIN __USER__ AS u ON u.id=au.user_id')->field($field)->limit($page->GetPageStarNumber(), $number)->order('au.id desc')->select());
|
||||
|
||||
// 性别
|
||||
|
|
@ -105,6 +105,9 @@ class AlipayLifeUserController extends CommonController
|
|||
// 注册时间
|
||||
$v['add_time'] = date('Y-m-d H:i:s', $v['add_time']);
|
||||
|
||||
// 关注时间
|
||||
$v['alipay_life_add_time'] = date('Y-m-d H:i:s', $v['alipay_life_add_time']);
|
||||
|
||||
// 更新时间
|
||||
$v['upd_time'] = date('Y-m-d H:i:s', $v['upd_time']);
|
||||
|
||||
|
|
|
|||
|
|
@ -48,5 +48,7 @@ return array(
|
|||
),
|
||||
|
||||
'alipay_life_message_user_text' => '给用户发送消息',
|
||||
'alipay_life_message_startup_time_text' => '发送启动时间',
|
||||
'alipay_life_message_success_time_text' => '发送完成时间',
|
||||
);
|
||||
?>
|
||||
|
|
@ -33,6 +33,7 @@ return array(
|
|||
'alipay_life_user_city_name' => '所在市',
|
||||
|
||||
'alipay_life_user_alipay_life_name_text' => '所属生活号',
|
||||
'alipay_life_user_appid_text' => 'appid',
|
||||
'alipay_life_user_send_text' => '发消息',
|
||||
);
|
||||
?>
|
||||
|
|
@ -12,16 +12,6 @@ use Think\Model;
|
|||
*/
|
||||
class AlipayLifeMessageModel extends CommonModel
|
||||
{
|
||||
// 数据自动校验
|
||||
protected $_validate = array(
|
||||
// 添加,编辑
|
||||
array('logo', '0,255', '{%alipay_life_logo_format}', 1, 'length', 3),
|
||||
array('name', '2,30', '{%alipay_life_name_format}', 1, 'length', 3),
|
||||
array('appid', '1,60', '{%alipay_life_appid_format}', 1, 'length', 3),
|
||||
array('rsa_public', '1,2000', '{%alipay_life_rsa_public_format}', 1, 'length', 3),
|
||||
array('rsa_private', '1,2000', '{%alipay_life_rsa_private_format}', 1, 'length', 3),
|
||||
array('out_rsa_public', '1,2000', '{%alipay_life_out_rsa_public_format}', 1, 'length', 3),
|
||||
array('alipay_life_category_id', 'require', '{%alipay_life_category_id_format}', 1, '', 3),
|
||||
);
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
@ -83,7 +83,7 @@
|
|||
<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/SendInfo', ['alipay_life_id'=>$v['id']])}}">
|
||||
<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>
|
||||
|
|
|
|||
|
|
@ -18,13 +18,19 @@
|
|||
<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_send_status_list" item="v">
|
||||
<option value="{{$v.id}}" <if condition="isset($param['status']) and $param['status'] eq $v['id']">selected</if>>{{$v.name}}</option>
|
||||
<option value="{{$v.value}}" <if condition="isset($param['status']) and $param['status'] eq $v['value']">selected</if>>{{$v.name}}</option>
|
||||
</foreach>
|
||||
</select>
|
||||
<select name="alipay_life_id" class="am-radius c-p m-t-10 m-l-5 param-where">
|
||||
<option value="">{{:L('alipay_life_message_name_text')}}</option>
|
||||
<foreach name="alipay_life_list" item="v">
|
||||
<option value="{{$v.id}}" <if condition="isset($param['alipay_life_id']) and $param['alipay_life_id'] eq $v['id']">selected</if>>{{$v.name}}</option>
|
||||
<select name="type" class="am-radius c-p m-t-10 m-l-5 param-where">
|
||||
<option value="-1">{{:L('alipay_life_message_type_text')}}</option>
|
||||
<foreach name="alipay_life_message_type_list" item="v">
|
||||
<option value="{{$v.value}}" <if condition="isset($param['type']) and $param['type'] eq $v['value']">selected</if>>{{$v.name}}</option>
|
||||
</foreach>
|
||||
</select>
|
||||
<select name="send_type" class="am-radius c-p m-t-10 m-l-5 param-where">
|
||||
<option value="-1">{{:L('alipay_life_message_send_type_text')}}</option>
|
||||
<foreach name="alipay_life_message_send_type_list" item="v">
|
||||
<option value="{{$v.value}}" <if condition="isset($param['send_type']) and $param['send_type'] eq $v['value']">selected</if>>{{$v.name}}</option>
|
||||
</foreach>
|
||||
</select>
|
||||
<div class="param-date param-where m-l-5">
|
||||
|
|
@ -39,7 +45,7 @@
|
|||
|
||||
<!-- operation start -->
|
||||
<div class="am-g m-t-15">
|
||||
<a href="{{:U('Admin/AlipayLifeMessage/SendInfo')}}" class="am-btn am-btn-secondary am-radius am-btn-xs am-icon-plus"> {{:L('common_operation_add')}}</a>
|
||||
<a href="{{:U('Admin/AlipayLifeMessage/SaveInfo')}}" class="am-btn am-btn-secondary am-radius am-btn-xs am-icon-plus"> {{:L('common_operation_add')}}</a>
|
||||
</div>
|
||||
<!-- operation end -->
|
||||
|
||||
|
|
@ -47,15 +53,15 @@
|
|||
<table class="am-table am-table-striped am-table-hover am-text-middle m-t-10">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{:L('alipay_life_message_life_text')}}</th>
|
||||
<th>{{:L('alipay_life_message_type_text')}}</th>
|
||||
<th>{{:L('alipay_life_message_title_text')}}</th>
|
||||
<th>{{:L('alipay_life_message_content_text')}}</th>
|
||||
<th>{{:L('alipay_life_message_send_type_text')}}</th>
|
||||
<th class="am-hide-sm-only">{{:L('alipay_life_message_title_text')}}</th>
|
||||
<th class="am-hide-sm-only">{{:L('alipay_life_message_content_text')}}</th>
|
||||
<th class="am-hide-sm-only">{{:L('alipay_life_message_image_url_text')}}</th>
|
||||
<th class="am-hide-sm-only">{{:L('alipay_life_message_url_text')}}</th>
|
||||
<th class="am-hide-sm-only">{{:L('alipay_life_message_action_name_text')}}</th>
|
||||
<th>{{:L('common_view_status_title')}}</th>
|
||||
<th class="am-hide-sm-only">{{:L('common_create_time_name')}}</th>
|
||||
<th>{{:L('common_more_name')}}</th>
|
||||
<th>{{:L('common_operation_name')}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
@ -63,10 +69,14 @@
|
|||
<if condition="!empty($list)">
|
||||
<foreach name="list" item="v">
|
||||
<tr id="data-list-{{$v.id}}">
|
||||
<td>{{$v.alipay_life_name}}</td>
|
||||
<td>{{$v.type_name}}</td>
|
||||
<td>{{$v.title}}</td>
|
||||
<td>{{$v.content}}</td>
|
||||
<td>{{$v.send_type_name}}</td>
|
||||
<td class="am-hide-sm-only">
|
||||
<if condition="empty($v['title'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.title}}</if>
|
||||
</td>
|
||||
<td class="am-hide-sm-only">
|
||||
<if condition="empty($v['content'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.content}}</if>
|
||||
</td>
|
||||
<td class="am-hide-sm-only">
|
||||
<if condition="!empty($v['image_url'])">
|
||||
<a href="{{$v['image_url']}}" target="_blank">
|
||||
|
|
@ -76,23 +86,85 @@
|
|||
<span class="cr-ddd">{{:L('common_on_fill_in_images')}}</span>
|
||||
</if>
|
||||
</td>
|
||||
<td class="am-hide-sm-only">{{$v.url}}</td>
|
||||
<td class="am-hide-sm-only">{{$v.action_name}}</td>
|
||||
<td class="am-hide-sm-only">
|
||||
<if condition="empty($v['url'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.url}}</if>
|
||||
</td>
|
||||
<td class="am-hide-sm-only">
|
||||
<if condition="empty($v['action_name'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.action_name}}</if>
|
||||
</td>
|
||||
<td>{{$v.status_name}}</td>
|
||||
<td class="am-hide-sm-only">{{$v.add_time_text}}</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_message_type_text')}}</dt>
|
||||
<dd><if condition="empty($v['type_name'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.type_name}}</if></dd>
|
||||
|
||||
<dt>{{:L('alipay_life_message_send_type_text')}}</dt>
|
||||
<dd><if condition="empty($v['send_type_name'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.send_type_name}}</if></dd>
|
||||
|
||||
<dt>{{:L('alipay_life_message_title_text')}}</dt>
|
||||
<dd><if condition="empty($v['title'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.title}}</if></dd>
|
||||
|
||||
<dt>{{:L('alipay_life_message_content_text')}}</dt>
|
||||
<dd><if condition="empty($v['content'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.content}}</if></dd>
|
||||
|
||||
<dt>{{:L('alipay_life_message_category_text')}}</dt>
|
||||
<dd><if condition="empty($v['category_all'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{:implode(',', $v['category_all'])}}</if></dd>
|
||||
|
||||
<dt>{{:L('alipay_life_message_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('alipay_life_message_image_url_text')}}</dt>
|
||||
<dd>
|
||||
<if condition="!empty($v['image_url'])">
|
||||
<img src="{{$v['image_url']}}" class="am-img-thumbnail am-radius" width="100" height="100" />
|
||||
<else />
|
||||
<span class="cr-ddd">{{:L('common_on_fill_in_images')}}</span>
|
||||
</if>
|
||||
</dd>
|
||||
|
||||
<dt>{{:L('alipay_life_message_url_text')}}</dt>
|
||||
<dd><if condition="empty($v['url'])"><span class="cr-ddd">{{:L('common_not_set_text')}}</span><else />{{$v.url}}</if></dd>
|
||||
|
||||
<dt>{{:L('alipay_life_message_action_name_text')}}</dt>
|
||||
<dd><if condition="empty($v['action_name'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.action_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_message_startup_time_text')}}</dt>
|
||||
<dd>{{$v.send_startup_time}}</dd>
|
||||
|
||||
<dt>{{:L('alipay_life_message_success_time_text')}}</dt>
|
||||
<dd>{{$v.send_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="$v['status'] eq 0">
|
||||
<a href="{{:U('Admin/AlipayLifeMessage/SendInfo', 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-send-o submit-ajax" data-url="{{:U('Admin/AlipayLifeMessage/Send')}}" data-id="{{$v.id}}" data-view="reload"> {{:L('common_send_text')}}</button>
|
||||
<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>
|
||||
</td>
|
||||
</tr>
|
||||
</foreach>
|
||||
<else />
|
||||
<tr><td colspan="7" class="table-no">{{:L('common_not_data_tips')}}</td></tr>
|
||||
<tr><td colspan="20" class="table-no">{{:L('common_not_data_tips')}}</td></tr>
|
||||
</if>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<ul class="am-nav am-nav-pills table-nav m-b-10">
|
||||
<foreach name="alipay_life_message_type_list" item="v">
|
||||
<li <if condition="$nav_type eq $v['value']">class="am-active"</if> data-type="{{$v.value}}">
|
||||
<a href="{{:U('Admin/AlipayLifeMessage/SendInfo', array_merge($params, ['nav_type'=>$v['value']]))}}">{{$v.name}}</a>
|
||||
<a href="{{:U('Admin/AlipayLifeMessage/SaveInfo', array_merge($params, ['nav_type'=>$v['value']]))}}">{{$v.name}}</a>
|
||||
</li>
|
||||
</foreach>
|
||||
</ul>
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
<notempty name="params.alipay_life_id">
|
||||
<div class="am-form-group">
|
||||
<label>{{:L('alipay_life_message_life_text')}}</label>
|
||||
<select name="alipay_life_id" class="am-radius c-p chosen-select" multiple="multiple" data-placeholder="{{:L('common_select_can_choose')}}" data-validation-message="{{:L('alipay_life_message_life_format')}}" <notempty name="params.alipay_life_id">disabled</notempty> required>
|
||||
<select name="alipay_life_id" class="am-radius c-p chosen-select" data-placeholder="{{:L('common_select_can_choose')}}" data-validation-message="{{:L('alipay_life_message_life_format')}}" <notempty name="params.alipay_life_id">disabled</notempty> required>
|
||||
<foreach name="alipay_life_list" item="v">
|
||||
<option value="{{$v.id}}" <if condition="$params['alipay_life_id'] eq $v['id']">selected</if>>{{$v.name}}</option>
|
||||
</foreach>
|
||||
|
|
@ -49,6 +49,7 @@
|
|||
<else />
|
||||
<div class="am-form-group">
|
||||
<label>{{:L('alipay_life_message_user_text')}}</label>
|
||||
<input type="hidden" name="user_id" value="{{$params.user_id}}" />
|
||||
<input type="hidden" name="alipay_life_user_id" value="{{$params.alipay_life_user_id}}" />
|
||||
<input type="text" class="am-radius" value="{{$alipay_openid}}" disabled />
|
||||
</div>
|
||||
|
|
@ -71,8 +72,8 @@
|
|||
<label class="block">{{:L('alipay_life_message_image_url_text')}}</label>
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm am-radius">
|
||||
<i class="am-icon-cloud-upload"></i> {{:L('common_select_images_text')}}</button>
|
||||
<input type="text" name="image_url" class="am-radius js-choice-one original-images-url original-icon-images-url" data-choice-one-to='input[name="file_image_url"]' data-validation-message="{{:L('alipay_life_message_image_url_format')}}" readonly="readonly" />
|
||||
<input type="file" name="file_image_url" multiple data-validation-message="{{:L('alipay_life_message_image_url_format')}}" accept="image/gif,image/jpeg,image/jpg,image/png" class="js-choice-one images-file-event file_image_url-tag" data-choice-one-to=".original-icon-images-url" data-tips-tag="#form-icon-tips" data-image-tag="#form-img-icon" />
|
||||
<input type="text" name="image_url" class="am-radius js-choice-one original-images-url original-icon-images-url" data-choice-one-to='input[name="file_image_url"]' data-validation-message="{{:L('alipay_life_message_image_url_format')}}" readonly="readonly" required />
|
||||
<input type="file" name="file_image_url" multiple data-validation-message="{{:L('alipay_life_message_image_url_format')}}" accept="image/gif,image/jpeg,image/jpg,image/png" class="js-choice-one images-file-event file_image_url-tag" data-choice-one-to=".original-icon-images-url" data-tips-tag="#form-icon-tips" data-image-tag="#form-img-icon" required />
|
||||
<div id="form-icon-tips" class="m-t-5"></div>
|
||||
<img src="{{$image_host}}/Public/Admin/Default/Images/default-images.png" id="form-img-icon" class="block m-t-5 am-img-thumbnail am-radius" width="100" height="100" data-default="{{$image_host}}/Public/Admin/Default/Images/default-images.png" />
|
||||
</div>
|
||||
|
|
@ -38,6 +38,7 @@
|
|||
<tr>
|
||||
<th>{{:L('alipay_life_user_avatar_name')}}</th>
|
||||
<th>{{:L('alipay_life_user_username_name')}}</th>
|
||||
<th>{{:L('alipay_life_user_appid_text')}}</th>
|
||||
<th class="am-hide-sm-only">{{:L('common_mobile_name')}}</th>
|
||||
<th class="am-hide-sm-only">{{:L('alipay_life_user_alipay_life_name_text')}}</th>
|
||||
<th class="am-hide-sm-only">{{:L('common_view_gender_name')}}</th>
|
||||
|
|
@ -60,6 +61,9 @@
|
|||
<td>
|
||||
<if condition="empty($v['username'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.username}}</if>
|
||||
</td>
|
||||
<td class="am-hide-sm-only">
|
||||
<if condition="empty($v['alipay_openid'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.alipay_openid}}</if>
|
||||
</td>
|
||||
<td class="am-hide-sm-only">
|
||||
<if condition="empty($v['mobile'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.mobile}}</if>
|
||||
</td>
|
||||
|
|
@ -88,6 +92,9 @@
|
|||
<dt>{{:L('alipay_life_user_nickname_name')}}</dt>
|
||||
<dd><if condition="empty($v['nickname'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.nickname}}</if></dd>
|
||||
|
||||
<dt>{{:L('alipay_life_user_appid_text')}}</dt>
|
||||
<dd><if condition="empty($v['alipay_openid'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.alipay_openid}}</if></dd>
|
||||
|
||||
<dt>{{:L('common_mobile_name')}}</dt>
|
||||
<dd><if condition="empty($v['mobile'])"><span class="cr-ddd">{{:L('common_on_fill_in_the_text')}}</span><else />{{$v.mobile}}</if></dd>
|
||||
|
||||
|
|
@ -121,6 +128,9 @@
|
|||
</if>
|
||||
</dd>
|
||||
|
||||
<dt>{{:L('common_focus_time_name')}}</dt>
|
||||
<dd>{{$v.alipay_life_add_time}}</dd>
|
||||
|
||||
<dt>{{:L('common_reg_time_name')}}</dt>
|
||||
<dd>{{$v.add_time}}</dd>
|
||||
|
||||
|
|
@ -132,7 +142,7 @@
|
|||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{:U('Admin/AlipayLifeMessage/SendInfo', ['user_id'=>$v['user_id'], 'alipay_life_user_id'=>$v['alipay_life_user_id']])}}">
|
||||
<a href="{{:U('Admin/AlipayLifeMessage/SaveInfo', ['user_id'=>$v['user_id'], 'alipay_life_user_id'=>$v['alipay_life_user_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>
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Api\Controller;
|
||||
|
||||
use Service\AlipayLifeService;
|
||||
|
||||
/**
|
||||
* 支付宝生活号回调处理
|
||||
* @author Devil
|
||||
|
|
@ -62,5 +64,18 @@ class AlipayLifeController extends CommonController
|
|||
exit('service error');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息发送
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-10-24
|
||||
* @desc description
|
||||
*/
|
||||
public function Send()
|
||||
{
|
||||
AlipayLifeService::MessageSend($_REQUEST);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -8,6 +8,32 @@
|
|||
* @datetime 2016-12-01T21:51:08+0800
|
||||
*/
|
||||
|
||||
/**
|
||||
* 异步调用方法
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-06-11
|
||||
* @desc 异步运行url地址方法
|
||||
* @param [string] $url [url地址 支持get参数]
|
||||
*/
|
||||
function SyncJob($url)
|
||||
{
|
||||
$url_str = str_replace(array('http://', 'https://'), '', $url);
|
||||
$location = strpos($url_str, '/');
|
||||
$host = substr($url_str, 0, $location);
|
||||
header("Content-Type: text/html; charset=utf-8");
|
||||
$fp = fsockopen($host, 80, $errno, $errstr, 3);
|
||||
if($fp)
|
||||
{
|
||||
$out = "GET $url HTTP/1.1\r\n";
|
||||
$out .= "Host: $host\r\n";
|
||||
$out .= "Connection: Close\r\n\r\n";
|
||||
fputs($fp, $out);
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* [DataReturn 公共返回数据]
|
||||
* @author Devil
|
||||
|
|
@ -1266,6 +1292,7 @@ function params_checked($data, $params)
|
|||
if (!isset($data[$v['key_name']]) || !in_array($data[$v['key_name']], $v['checked_data'])) {
|
||||
return $v['error_msg'];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'is_array' :
|
||||
if (!isset($data[$v['key_name']]) || !is_array($data[$v['key_name']])) {
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ return array(
|
|||
'common_not_login_name' => '未登录',
|
||||
'common_not_data_tips' => '没有相关数据',
|
||||
'common_create_time_name' => '创建时间',
|
||||
'common_focus_time_name' => '关注时间',
|
||||
'common_reg_time_name' => '注册时间',
|
||||
'common_upd_time_name' => '更新时间',
|
||||
'common_time_start_name' => '起始时间',
|
||||
|
|
@ -64,6 +65,7 @@ return array(
|
|||
'common_nav_type_name' => '导航数据类型',
|
||||
'common_view_link_name' => '友情链接',
|
||||
'common_site_maintenance_tips' => '网站维护中...',
|
||||
'common_send_text' => '发送',
|
||||
'common_send_tips' => '发送中...',
|
||||
'common_send_success' => '发送成功',
|
||||
'common_send_error' => '发送失败',
|
||||
|
|
|
|||
|
|
@ -35,12 +35,13 @@ class AlipayLife
|
|||
{
|
||||
$this->params = $params;
|
||||
$this->xml_data = isset($params['biz_content']) ? $this->XmlToArray($params['biz_content']) : '';
|
||||
$this->life_data = isset($this->xml_data['AppId']) ? AlipayLifeService::AppidLifeRow(['appid'=>$this->xml_data['AppId']]) : '';
|
||||
|
||||
// 当前生活号是否存在
|
||||
if(empty($this->life_data))
|
||||
|
||||
// 生活号
|
||||
if(!empty($params['life_data']))
|
||||
{
|
||||
die('life error');
|
||||
$this->life_data = $params['life_data'];
|
||||
} else {
|
||||
$this->life_data = isset($this->xml_data['AppId']) ? AlipayLifeService::AppidLifeRow(['appid'=>$this->xml_data['AppId']]) : '';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +58,7 @@ class AlipayLife
|
|||
{
|
||||
$res = "-----BEGIN RSA PRIVATE KEY-----\n";
|
||||
$res .= wordwrap($this->life_data['rsa_private'], 64, "\n", true);
|
||||
$res .= "\nEND RSA PRIVATE KEY-----";
|
||||
$res .= "\n-----END RSA PRIVATE KEY-----";
|
||||
return openssl_sign($prestr, $sign, $res, OPENSSL_ALGO_SHA256) ? base64_encode($sign) : null;
|
||||
}
|
||||
|
||||
|
|
@ -143,16 +144,16 @@ class AlipayLife
|
|||
*/
|
||||
public function ArrayToUrlString($data)
|
||||
{
|
||||
$ur_lstring = '';
|
||||
$url_string = '';
|
||||
ksort($data);
|
||||
foreach($data AS $key=>$val)
|
||||
{
|
||||
if(!in_array($key, ['sign']))
|
||||
{
|
||||
$ur_lstring .= "$key=$val&";
|
||||
$url_string .= "$key=$val&";
|
||||
}
|
||||
}
|
||||
return substr($ur_lstring, 0, -1);
|
||||
return substr($url_string, 0, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -183,6 +184,51 @@ class AlipayLife
|
|||
die($return_xml);
|
||||
}
|
||||
|
||||
/**
|
||||
* [HttpRequest 网络请求]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @datetime 2017-09-25T09:10:46+0800
|
||||
* @param [string] $url [请求url]
|
||||
* @param [array] $data [发送数据]
|
||||
* @return [mixed] [请求返回数据]
|
||||
*/
|
||||
private function HttpRequest($url, $data)
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_FAILONERROR, false);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
|
||||
$body_string = '';
|
||||
if(is_array($data) && 0 < count($data))
|
||||
{
|
||||
foreach($data as $k => $v)
|
||||
{
|
||||
$body_string .= $k.'='.urlencode($v).'&';
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $body_string);
|
||||
}
|
||||
$headers = array('content-type: application/x-www-form-urlencoded;charset=UTF-8');
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
$reponse = curl_exec($ch);
|
||||
if(curl_errno($ch))
|
||||
{
|
||||
return false;
|
||||
} else {
|
||||
$httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
if(200 !== $httpStatusCode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
curl_close($ch);
|
||||
return json_decode($reponse, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验
|
||||
* @author Devil
|
||||
|
|
@ -193,6 +239,13 @@ class AlipayLife
|
|||
*/
|
||||
public function Check()
|
||||
{
|
||||
// 当前生活号是否存在
|
||||
if(empty($this->life_data))
|
||||
{
|
||||
die('life error');
|
||||
}
|
||||
|
||||
// 开始处理
|
||||
$status = $this->OutRsaVerify($this->ArrayToUrlString($this->params), $this->params['sign']);
|
||||
$this->Respond($status);
|
||||
}
|
||||
|
|
@ -206,6 +259,13 @@ class AlipayLife
|
|||
*/
|
||||
public function Life()
|
||||
{
|
||||
// 当前生活号是否存在
|
||||
if(empty($this->life_data))
|
||||
{
|
||||
die('life error');
|
||||
}
|
||||
|
||||
// 开始处理
|
||||
$status = false;
|
||||
if($this->OutRsaVerify($this->ArrayToUrlString($this->params), $this->params['sign']))
|
||||
{
|
||||
|
|
@ -234,5 +294,101 @@ class AlipayLife
|
|||
$this->Respond($status);
|
||||
}
|
||||
|
||||
/**
|
||||
* 单条消息发送
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-10-24
|
||||
* @desc description
|
||||
* @param [array] $data [输入参数]
|
||||
*/
|
||||
public function CustomSend($params = [])
|
||||
{
|
||||
// 参数处理
|
||||
$p = $this->RequestCommonParams();
|
||||
$p['method'] = 'alipay.open.public.message.custom.send';
|
||||
$biz_content = [
|
||||
'to_user_id' => $params['alipay_openid'],
|
||||
'msg_type' => ($params['msg_type'] == 0) ? 'text' : 'image-text',
|
||||
'chat' => 0,
|
||||
];
|
||||
if($params['msg_type'] == 1)
|
||||
{
|
||||
$biz_content['articles'] = [
|
||||
'title' => isset($params['title']) ? $params['title'] : '',
|
||||
'desc' => $params['content'],
|
||||
'image_url' => $params['out_image_url'],
|
||||
'url' => $params['url'],
|
||||
'action_name' => isset($params['action_name']) ? $params['action_name'] : '',
|
||||
];
|
||||
} else {
|
||||
$biz_content['text'] = ['content'=>$params['content']];
|
||||
}
|
||||
$p['biz_content'] = json_encode($biz_content, JSON_UNESCAPED_UNICODE);
|
||||
|
||||
// 生成签名
|
||||
$p['sign'] = $this->MyRsaSign($this->ArrayToUrlString($p));
|
||||
|
||||
$result = $this->HttpRequest('https://openapi.alipay.com/gateway.do', $p);
|
||||
|
||||
|
||||
|
||||
print_r($result);
|
||||
echo "\n\n";
|
||||
print_r($p);
|
||||
die;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* [GetParamSign 生成参数和签名]
|
||||
* @param [array] $data [待生成的参数]
|
||||
* @param [array] $config [配置信息]
|
||||
* @return [array] [生成好的参数和签名]
|
||||
*/
|
||||
private function GetParamSign($data, $config = [])
|
||||
{
|
||||
$param = '';
|
||||
$sign = '';
|
||||
ksort($data);
|
||||
|
||||
foreach($data AS $key => $val)
|
||||
{
|
||||
$param .= "$key=" .urlencode($val). "&";
|
||||
$sign .= "$key=$val&";
|
||||
}
|
||||
|
||||
$result = array(
|
||||
'param' => substr($param, 0, -1),
|
||||
'value' => substr($sign, 0, -1),
|
||||
);
|
||||
if(!empty($config['key']))
|
||||
{
|
||||
$result['sign'] = $result['value'].$config['key'];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取公共参数
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-10-24
|
||||
* @desc description
|
||||
*/
|
||||
private function RequestCommonParams()
|
||||
{
|
||||
return [
|
||||
'app_id' => $this->life_data['appid'],
|
||||
'format' => 'JSON',
|
||||
'charset' => 'utf-8',
|
||||
'sign_type' => 'RSA2',
|
||||
'timestamp' => date('Y-m-d H:i:s'),
|
||||
'version' => '1.0',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
<?php
|
||||
//000000000000a:151:{i:41;s:12:"config_index";i:42;s:11:"config_save";i:81;s:10:"site_index";i:103;s:10:"site_index";i:105;s:9:"site_save";i:104;s:9:"sms_index";i:107;s:8:"sms_save";i:219;s:11:"email_index";i:220;s:10:"email_save";i:221;s:15:"email_emailtest";i:199;s:9:"seo_index";i:200;s:8:"seo_save";i:1;s:11:"power_index";i:22;s:11:"admin_index";i:19;s:14:"admin_saveinfo";i:20;s:10:"admin_save";i:21;s:12:"admin_delete";i:4;s:10:"power_role";i:17;s:18:"power_rolesaveinfo";i:18;s:14:"power_rolesave";i:23;s:16:"power_roledelete";i:13;s:11:"power_index";i:15;s:15:"power_powersave";i:16;s:17:"power_powerdelete";i:126;s:10:"user_index";i:127;s:10:"user_index";i:128;s:13:"user_saveinfo";i:129;s:9:"user_save";i:130;s:11:"user_delete";i:146;s:16:"user_excelexport";i:38;s:11:"goods_index";i:39;s:11:"goods_index";i:57;s:14:"goods_saveinfo";i:58;s:10:"goods_save";i:59;s:12:"goods_delete";i:181;s:19:"goods_statusshelves";i:218;s:27:"goods_statushomerecommended";i:201;s:19:"goodscategory_index";i:202;s:18:"goodscategory_save";i:203;s:20:"goodscategory_delete";i:177;s:11:"order_index";i:178;s:11:"order_index";i:179;s:12:"order_delete";i:180;s:12:"order_cancel";i:267;s:14:"order_delivery";i:268;s:13:"order_collect";i:269;s:9:"order_pay";i:213;s:12:"answer_index";i:214;s:12:"answer_index";i:215;s:11:"answer_save";i:216;s:13:"answer_delete";i:217;s:19:"answer_statusupdate";i:222;s:16:"navigation_index";i:223;s:16:"navigation_index";i:226;s:15:"navigation_save";i:227;s:17:"navigation_delete";i:228;s:23:"navigation_statusupdate";i:234;s:16:"customview_index";i:235;s:19:"customview_saveinfo";i:236;s:15:"customview_save";i:237;s:17:"customview_delete";i:238;s:23:"customview_statusupdate";i:239;s:10:"link_index";i:240;s:13:"link_saveinfo";i:241;s:9:"link_save";i:242;s:11:"link_delete";i:243;s:17:"link_statusupdate";i:244;s:11:"theme_index";i:245;s:10:"theme_save";i:246;s:12:"theme_upload";i:247;s:12:"theme_delete";i:252;s:11:"brand_index";i:249;s:11:"brand_index";i:256;s:14:"brand_saveinfo";i:250;s:10:"brand_save";i:257;s:17:"brand_stateupdate";i:251;s:12:"brand_delete";i:253;s:19:"brandcategory_index";i:254;s:18:"brandcategory_save";i:255;s:20:"brandcategory_delete";i:270;s:16:"alipaylife_index";i:271;s:16:"alipaylife_index";i:272;s:19:"alipaylife_saveinfo";i:273;s:15:"alipaylife_save";i:284;s:23:"alipaylife_statusupdate";i:274;s:17:"alipaylife_delete";i:281;s:24:"alipaylifecategory_index";i:282;s:23:"alipaylifecategory_save";i:283;s:25:"alipaylifecategory_delete";i:275;s:23:"alipaylifemessage_index";i:276;s:26:"alipaylifemessage_sendinfo";i:277;s:22:"alipaylifemessage_send";i:278;s:24:"alipaylifemessage_delete";i:279;s:20:"alipaylifeuser_index";i:280;s:21:"alipaylifeuser_delete";i:204;s:13:"article_index";i:205;s:13:"article_index";i:206;s:16:"article_saveinfo";i:207;s:12:"article_save";i:208;s:14:"article_delete";i:209;s:20:"article_statusupdate";i:248;s:29:"article_statushomerecommended";i:210;s:21:"articlecategory_index";i:211;s:20:"articlecategory_save";i:212;s:22:"articlecategory_delete";i:162;s:15:"marketing_index";i:163;s:12:"coupon_index";i:164;s:18:"coupon_stateupdate";i:165;s:15:"coupon_saveinfo";i:166;s:11:"coupon_save";i:167;s:11:"coupon_user";i:168;s:13:"coupon_delete";i:169;s:15:"coupon_sendinfo";i:170;s:11:"coupon_send";i:171;s:16:"coupon_userquery";i:182;s:10:"data_index";i:183;s:13:"message_index";i:184;s:14:"message_delete";i:185;s:12:"paylog_index";i:186;s:21:"userintegrallog_index";i:187;s:15:"complaint_index";i:188;s:14:"complaint_save";i:189;s:16:"complaint_delete";i:152;s:15:"resources_index";i:153;s:12:"region_index";i:154;s:11:"region_save";i:155;s:13:"region_delete";i:156;s:13:"express_index";i:157;s:12:"express_save";i:158;s:14:"express_delete";i:172;s:11:"slide_index";i:173;s:14:"slide_saveinfo";i:174;s:10:"slide_save";i:175;s:17:"slide_stateupdate";i:176;s:12:"slide_delete";i:193;s:20:"screeningprice_index";i:194;s:19:"screeningprice_save";i:258;s:21:"screeningprice_delete";i:259;s:13:"payment_index";i:260;s:16:"payment_saveinfo";i:261;s:12:"payment_save";i:262;s:14:"payment_delete";i:263;s:15:"payment_install";i:264;s:20:"payment_statusupdate";i:265;s:17:"payment_uninstall";i:266;s:14:"payment_upload";i:118;s:10:"tool_index";i:119;s:11:"cache_index";i:120;s:16:"cache_siteupdate";i:121;s:20:"cache_templateupdate";i:122;s:18:"cache_moduleupdate";}
|
||||
//000000000000a:152:{i:41;s:12:"config_index";i:42;s:11:"config_save";i:81;s:10:"site_index";i:103;s:10:"site_index";i:105;s:9:"site_save";i:104;s:9:"sms_index";i:107;s:8:"sms_save";i:219;s:11:"email_index";i:220;s:10:"email_save";i:221;s:15:"email_emailtest";i:199;s:9:"seo_index";i:200;s:8:"seo_save";i:1;s:11:"power_index";i:22;s:11:"admin_index";i:19;s:14:"admin_saveinfo";i:20;s:10:"admin_save";i:21;s:12:"admin_delete";i:4;s:10:"power_role";i:17;s:18:"power_rolesaveinfo";i:18;s:14:"power_rolesave";i:23;s:16:"power_roledelete";i:13;s:11:"power_index";i:15;s:15:"power_powersave";i:16;s:17:"power_powerdelete";i:126;s:10:"user_index";i:127;s:10:"user_index";i:128;s:13:"user_saveinfo";i:129;s:9:"user_save";i:130;s:11:"user_delete";i:146;s:16:"user_excelexport";i:38;s:11:"goods_index";i:39;s:11:"goods_index";i:57;s:14:"goods_saveinfo";i:58;s:10:"goods_save";i:59;s:12:"goods_delete";i:181;s:19:"goods_statusshelves";i:218;s:27:"goods_statushomerecommended";i:201;s:19:"goodscategory_index";i:202;s:18:"goodscategory_save";i:203;s:20:"goodscategory_delete";i:177;s:11:"order_index";i:178;s:11:"order_index";i:179;s:12:"order_delete";i:180;s:12:"order_cancel";i:267;s:14:"order_delivery";i:268;s:13:"order_collect";i:269;s:9:"order_pay";i:213;s:12:"answer_index";i:214;s:12:"answer_index";i:215;s:11:"answer_save";i:216;s:13:"answer_delete";i:217;s:19:"answer_statusupdate";i:222;s:16:"navigation_index";i:223;s:16:"navigation_index";i:226;s:15:"navigation_save";i:227;s:17:"navigation_delete";i:228;s:23:"navigation_statusupdate";i:234;s:16:"customview_index";i:235;s:19:"customview_saveinfo";i:236;s:15:"customview_save";i:237;s:17:"customview_delete";i:238;s:23:"customview_statusupdate";i:239;s:10:"link_index";i:240;s:13:"link_saveinfo";i:241;s:9:"link_save";i:242;s:11:"link_delete";i:243;s:17:"link_statusupdate";i:244;s:11:"theme_index";i:245;s:10:"theme_save";i:246;s:12:"theme_upload";i:247;s:12:"theme_delete";i:252;s:11:"brand_index";i:249;s:11:"brand_index";i:256;s:14:"brand_saveinfo";i:250;s:10:"brand_save";i:257;s:17:"brand_stateupdate";i:251;s:12:"brand_delete";i:253;s:19:"brandcategory_index";i:254;s:18:"brandcategory_save";i:255;s:20:"brandcategory_delete";i:270;s:16:"alipaylife_index";i:271;s:16:"alipaylife_index";i:272;s:19:"alipaylife_saveinfo";i:273;s:15:"alipaylife_save";i:284;s:23:"alipaylife_statusupdate";i:274;s:17:"alipaylife_delete";i:281;s:24:"alipaylifecategory_index";i:282;s:23:"alipaylifecategory_save";i:283;s:25:"alipaylifecategory_delete";i:275;s:23:"alipaylifemessage_index";i:276;s:26:"alipaylifemessage_saveinfo";i:277;s:22:"alipaylifemessage_save";i:278;s:24:"alipaylifemessage_delete";i:285;s:22:"alipaylifemessage_send";i:279;s:20:"alipaylifeuser_index";i:280;s:21:"alipaylifeuser_delete";i:204;s:13:"article_index";i:205;s:13:"article_index";i:206;s:16:"article_saveinfo";i:207;s:12:"article_save";i:208;s:14:"article_delete";i:209;s:20:"article_statusupdate";i:248;s:29:"article_statushomerecommended";i:210;s:21:"articlecategory_index";i:211;s:20:"articlecategory_save";i:212;s:22:"articlecategory_delete";i:162;s:15:"marketing_index";i:163;s:12:"coupon_index";i:164;s:18:"coupon_stateupdate";i:165;s:15:"coupon_saveinfo";i:166;s:11:"coupon_save";i:167;s:11:"coupon_user";i:168;s:13:"coupon_delete";i:169;s:15:"coupon_sendinfo";i:170;s:11:"coupon_send";i:171;s:16:"coupon_userquery";i:182;s:10:"data_index";i:183;s:13:"message_index";i:184;s:14:"message_delete";i:185;s:12:"paylog_index";i:186;s:21:"userintegrallog_index";i:187;s:15:"complaint_index";i:188;s:14:"complaint_save";i:189;s:16:"complaint_delete";i:152;s:15:"resources_index";i:153;s:12:"region_index";i:154;s:11:"region_save";i:155;s:13:"region_delete";i:156;s:13:"express_index";i:157;s:12:"express_save";i:158;s:14:"express_delete";i:172;s:11:"slide_index";i:173;s:14:"slide_saveinfo";i:174;s:10:"slide_save";i:175;s:17:"slide_stateupdate";i:176;s:12:"slide_delete";i:193;s:20:"screeningprice_index";i:194;s:19:"screeningprice_save";i:258;s:21:"screeningprice_delete";i:259;s:13:"payment_index";i:260;s:16:"payment_saveinfo";i:261;s:12:"payment_save";i:262;s:14:"payment_delete";i:263;s:15:"payment_install";i:264;s:20:"payment_statusupdate";i:265;s:17:"payment_uninstall";i:266;s:14:"payment_upload";i:118;s:10:"tool_index";i:119;s:11:"cache_index";i:120;s:16:"cache_siteupdate";i:121;s:20:"cache_templateupdate";i:122;s:18:"cache_moduleupdate";}
|
||||
?>
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -11,6 +11,151 @@ namespace Service;
|
|||
*/
|
||||
class AlipayLifeService
|
||||
{
|
||||
/**
|
||||
* 消息添加
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-10-24
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function MessageAdd($params = [])
|
||||
{
|
||||
// 参数校验
|
||||
$ret = self::MessageAddCheck($params);
|
||||
if($ret['code'] != 0)
|
||||
{
|
||||
return $ret;
|
||||
}
|
||||
|
||||
// 开始处理业务
|
||||
$data = [
|
||||
'user_id' => isset($params['user_id']) ? intval($params['user_id']) : 0,
|
||||
'alipay_life_user_id' => isset($params['alipay_life_user_id']) ? intval($params['alipay_life_user_id']) : 0,
|
||||
'alipay_life_id' => empty($params['alipay_life_id']) ? 0 : intval($params['alipay_life_id']),
|
||||
'alipay_life_category_id' => empty($params['alipay_life_category_id']) ? '' : json_encode(explode(',', $params['alipay_life_category_id'])),
|
||||
'type' => intval($params['type']),
|
||||
'send_type' => intval($params['send_type']),
|
||||
'status' => 0,
|
||||
'title' => I('title', '', null, $params),
|
||||
'content' => I('content', '', null, $params),
|
||||
'url' => I('url', '', null, $params),
|
||||
'action_name' => I('action_name', '', null, $params),
|
||||
'add_time' => time(),
|
||||
];
|
||||
if(M('AlipayLifeMessage')->add($data))
|
||||
{
|
||||
return DataReturn(L('common_operation_add_success'), 0);
|
||||
}
|
||||
return DataReturn(L('common_operation_add_error'), -100);
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息添加参数校验
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-10-24
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function MessageAddCheck($params = [])
|
||||
{
|
||||
// 基础参数
|
||||
$p = [
|
||||
[
|
||||
'checked_type' => 'in',
|
||||
'key_name' => 'type',
|
||||
'checked_data' => [0,1],
|
||||
'error_msg' => '消息类型有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'in',
|
||||
'key_name' => 'send_type',
|
||||
'checked_data' => [0,1],
|
||||
'error_msg' => '发送类型有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'content',
|
||||
'error_msg' => '消息内容有误',
|
||||
],
|
||||
];
|
||||
$ret = params_checked($params, $p);
|
||||
if($ret !== true)
|
||||
{
|
||||
return DataReturn($ret, -1);
|
||||
}
|
||||
|
||||
// 发送类型
|
||||
$p = [];
|
||||
switch($params['send_type'])
|
||||
{
|
||||
// 单条
|
||||
case 0 :
|
||||
$p[] = [
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'user_id',
|
||||
'error_msg' => '指定用户id有误',
|
||||
];
|
||||
$p[] = [
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'alipay_life_user_id',
|
||||
'error_msg' => '指定生活号用户id有误',
|
||||
];
|
||||
break;
|
||||
|
||||
// 批量
|
||||
case 1 :
|
||||
if(empty($params['alipay_life_category_id']) && empty($params['alipay_life_id']))
|
||||
{
|
||||
return DataReturn('批量id有误', -1);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
// 图文
|
||||
if($params['type'] == 1)
|
||||
{
|
||||
// 图片项
|
||||
if(empty($_FILES['file_image_url']))
|
||||
{
|
||||
return DataReturn('请上传封面图片', -1);
|
||||
}
|
||||
|
||||
// 文本项
|
||||
$p[] = [
|
||||
'checked_type' => 'isset',
|
||||
'key_name' => 'title',
|
||||
'error_msg' => '消息标题有误',
|
||||
];
|
||||
$p[] = [
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'url',
|
||||
'error_msg' => '图文url跳转地址有误',
|
||||
];
|
||||
$p[] = [
|
||||
'checked_type' => 'isset',
|
||||
'key_name' => 'action_name',
|
||||
'error_msg' => '链接文字有误',
|
||||
];
|
||||
}
|
||||
|
||||
// 验证
|
||||
if(!empty($p))
|
||||
{
|
||||
$ret = params_checked($params, $p);
|
||||
if($ret !== true)
|
||||
{
|
||||
return DataReturn($ret, -1);
|
||||
}
|
||||
}
|
||||
|
||||
return DataReturn('验证成功', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据appid获取一条生活号事件
|
||||
* @author Devil
|
||||
|
|
@ -98,5 +243,217 @@ class AlipayLifeService
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息发送
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-10-24
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function MessageSubmit($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('AlipayLifeMessage');
|
||||
$message = $m->find(intval($params['id']));
|
||||
if(empty($message))
|
||||
{
|
||||
return DataReturn('消息纪录不存在', -1);
|
||||
}
|
||||
$common_send_status_list = L('common_send_status_list');
|
||||
if($message['status'] != 0)
|
||||
{
|
||||
return DataReturn('状态不可操作['.$common_send_status_list[$message['status']]['name'].']', -2);
|
||||
}
|
||||
|
||||
// 发送类型
|
||||
$user = [];
|
||||
if($message['send_type'] == 1)
|
||||
{
|
||||
if(!empty($message['alipay_life_category_id']))
|
||||
{
|
||||
$category_all = json_decode($message['alipay_life_category_id'], true);
|
||||
$alipay_life_all = M('AlipayLifeCategoryJoin')->where(['alipay_life_category_id'=>['in', $category_all]])->group('alipay_life_id')->getField('alipay_life_id', true);
|
||||
} else {
|
||||
$alipay_life_all = [$message['alipay_life_id']];
|
||||
}
|
||||
foreach($alipay_life_all as $alipay_life_id)
|
||||
{
|
||||
$temp_user = M('AlipayLifeUser')->where(['alipay_life_id'=>$alipay_life_id])->select();
|
||||
if(!empty($temp_user))
|
||||
{
|
||||
foreach($temp_user as $u)
|
||||
{
|
||||
$alipay_openid = M('User')->where(['id'=>$u['user_id']])->getField('alipay_openid');
|
||||
if(!empty($alipay_openid))
|
||||
{
|
||||
$user[] = [
|
||||
'user_id' => $u['user_id'],
|
||||
'alipay_life_id' => $u['alipay_life_id'],
|
||||
'alipay_life_user_id' => $u['id'],
|
||||
'alipay_openid' => $alipay_openid,
|
||||
'alipay_life_message_id'=> $message['id'],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$alipay_openid = M('User')->where(['id'=>$message['user_id']])->getField('alipay_openid');
|
||||
if(!empty($alipay_openid))
|
||||
{
|
||||
$user[] = [
|
||||
'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'],
|
||||
'alipay_openid' => $alipay_openid,
|
||||
'alipay_life_message_id'=> $message['id'],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 入库详情表
|
||||
$m->startTrans();
|
||||
if(M('AlipayLifeMessageDetail')->addAll($user) !== false)
|
||||
{
|
||||
if($m->where(['id'=>$message['id']])->save(['status'=>1, 'send_startup_time'=>time(), 'upd_time'=>time()]) !== false)
|
||||
{
|
||||
self::SyncJobSend($message['id']);
|
||||
$m->commit();
|
||||
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 [type] $message_id [description]
|
||||
*/
|
||||
public static function SyncJobSend($message_id)
|
||||
{
|
||||
SyncJob(U('Api/AlipayLife/Send', ['message_id'=>$message_id], true, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息发送
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-10-24
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function MessageSend($params = [])
|
||||
{
|
||||
if(empty($params['message_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 '[message:'.$params['message_id']."]\n";
|
||||
|
||||
// 开始处理
|
||||
$m = M('AlipayLifeMessage');
|
||||
$message = $m->find($params['message_id']);
|
||||
if(empty($message))
|
||||
{
|
||||
die('[time:'.date('Y-m-d H:i:s'))."][msg:{$params['message_id']}数据不存在]\n\n";
|
||||
}
|
||||
if(!in_array($message['sttaus'], [0,1]))
|
||||
{
|
||||
die('[time:'.date('Y-m-d H:i:s'))."][msg:{$message['status']}状态不可操作]\n\n";
|
||||
}
|
||||
|
||||
// 消息类型
|
||||
if($message['send_type'] == 1)
|
||||
{
|
||||
if(!empty($message['alipay_life_category_id']))
|
||||
{
|
||||
$category_all = json_decode($message['alipay_life_category_id'], true);
|
||||
$alipay_life_all = M('AlipayLifeCategoryJoin')->where(['alipay_life_category_id'=>['in', $category_all]])->group('alipay_life_id')->getField('alipay_life_id', true);
|
||||
} else {
|
||||
$alipay_life_all = [$message['alipay_life_id']];
|
||||
}
|
||||
} else {
|
||||
$alipay_life_all = [M('AlipayLifeUser')->where(['id'=>$message['alipay_life_user_id']])->getField('alipay_life_id')];
|
||||
}
|
||||
|
||||
// 生活号循环处理
|
||||
foreach($alipay_life_all as $alipay_life_id)
|
||||
{
|
||||
// 生活号
|
||||
$life = M('AlipayLife')->find($alipay_life_id);
|
||||
|
||||
// 群发发
|
||||
if($message['send_type'] == 1)
|
||||
{
|
||||
die('all');
|
||||
// 单个消息发送
|
||||
} else {
|
||||
$detail_m = M('AlipayLifeMessageDetail');
|
||||
$detail = $detail_m->where(['alipay_life_message_id'=>$message['id'], 'status'=>0])->limit(100)->select();
|
||||
if(!empty($detail))
|
||||
{
|
||||
$obj = new \Library\AlipayLife(['life_data'=>$life]);
|
||||
foreach($detail as $v)
|
||||
{
|
||||
$message['alipay_openid'] = $v['alipay_openid'];
|
||||
$obj->CustomSend($message);
|
||||
//print_r($message);
|
||||
die;
|
||||
}
|
||||
} else {
|
||||
$m->where(['id'=>$message['id']])->save(['send_success_time'=>time(), 'status'=>2]);
|
||||
echo '[success_time:'.date('Y-m-d H:i:s')."]\n";
|
||||
echo '[message:'.$params['message_id']."]\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
die('end');
|
||||
|
||||
// 获取详情处理发送消息
|
||||
// $detail_m = M('AlipayLifeMessageDetail');
|
||||
// $detail = $detail_m->where(['alipay_life_message_id'=>$message['id'], 'status'=>0])->limit(100)->select();
|
||||
// if(!empty($detail))
|
||||
// {
|
||||
// $obj = new \Library\AlipayLife($params);
|
||||
// foreach($detail as $v)
|
||||
// {
|
||||
// $obj->CustomSend($message);
|
||||
// print_r($message);
|
||||
// die;
|
||||
// }
|
||||
// } else {
|
||||
// $m->where(['id'=>$message['id']])->save(['send_success_time'=>time(), 'status'=>2]);
|
||||
// echo '[success_time:'.date('Y-m-d H:i:s')."]\n";
|
||||
// echo '[message:'.$params['message_id']."]\n\n";
|
||||
// }
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
47
shopxo.sql
47
shopxo.sql
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue