<?php
|
|
|
/**
|
* 订阅管理
|
* @date 2019-10-25
|
*/
|
class subscribe_controller extends user
|
{
|
|
function index_action()
|
{
|
$this -> public_action();
|
|
$subscribeM = $this->MODEL('subscribe');
|
|
$userinfoM = $this->MODEL('userinfo');
|
|
$WxM = $this->MODEL('weixin');
|
|
$userInfo = $userinfoM->getInfo(array('uid' => $this->uid), array('field' => '`wxid`, `wxopenid`'));
|
|
if (empty($userInfo['wxid']) || empty($userInfo['wxopenid'])) {
|
|
$qrcode = $WxM->applyWxQrcode($_COOKIE['wxloginid'], '', $this->uid);
|
|
$this->yunset('qrcode', $qrcode);
|
}
|
|
$where['uid'] = $this->uid;
|
|
$where['type'] = 1;
|
|
$urlarr['c'] = $_GET['c'];
|
|
$urlarr['page'] = '{{page}}';
|
|
$pageurl = Url('member', $urlarr);
|
|
$pageM = $this->MODEL('page');
|
|
$pages = $pageM->pageList('subscribe', $where, $pageurl, $_GET['page']);
|
|
if ($pages['total'] > 0) {
|
|
$where['orderby'] = 'id';
|
$where['limit'] = $pages['limit'];
|
$List = $subscribeM->getList($where);
|
}
|
$this->yunset('rows', $List);
|
$this->yunset("js_def", 3);
|
$this->user_tpl('subscribe');
|
}
|
//发送记录
|
function record_action()
|
{
|
$this->public_action();
|
$where['uid'] = $this->uid;
|
$where['type'] = 1;
|
$urlarr['c'] = $_GET['c'];
|
$urlarr['act'] = $_GET['act'];
|
$urlarr['page'] = '{{page}}';
|
$pageurl = Url('member', $urlarr);
|
|
$pageM = $this->MODEL('page');
|
$pages = $pageM->pageList('subscriberecord', $where, $pageurl, $_GET['page']);
|
|
if ($pages['total'] > 0) {
|
$where['orderby'] = 'id';
|
$where['limit'] = $pages['limit'];
|
|
$subscribeM = $this->MODEL('subscribe');
|
|
$List = $subscribeM->getRecordList($where);
|
}
|
$this->yunset("rows", $List);
|
$this->yunset("js_def", 3);
|
$this->user_tpl('subscriberecord');
|
}
|
//删除职位订阅
|
function del_action()
|
{
|
$subscribeM = $this->MODEL('subscribe');
|
if ($_GET['del'] || $_GET['id']) {
|
|
if ($_GET['id']) {
|
|
$id = intval($_GET['id']);
|
} elseif ($_POST['del']) {
|
|
$id = $_POST['del'];
|
}
|
|
$return = $subscribeM->del($id, array('uid' => $this->uid, 'usertype' => $this->usertype));
|
$this->layer_msg($return['msg'], $return['errcode'], $return['layertype'], $_SERVER['HTTP_REFERER']);
|
}
|
}
|
//订阅前检查
|
function subscribedingyue_action()
|
{
|
$userinfoM = $this->MODEL('userinfo');
|
|
$WxM = $this->MODEL('weixin');
|
|
$userInfo = $userinfoM->getInfo(array('uid' => $this->uid), array('field' => '`wxid`, `wxopenid`'));
|
|
if (empty($userInfo)) {
|
|
echo 1;
|
die();
|
}
|
|
if ($this->usertype && $this->usertype != 1 && $this->usertype != 2) {
|
|
echo 2;
|
die(); // 只有个人和企业用户才可订阅!
|
}
|
// 判断微信是否开启
|
if (empty($userInfo['wxid']) && empty($userInfo['wxopenid'])) {
|
|
$qrcode = $WxM->applyWxQrcode($_COOKIE['wxloginid'], '', $this->uid);
|
if (empty($qrcode)) {
|
echo 3;
|
die();
|
} else {
|
echo 4;
|
die();
|
}
|
} else {
|
echo 5;
|
die();
|
}
|
}
|
}
|
?>
|