123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Bear
- * Date: 2020/3/23
- * Time: 下午5:51
- */
- namespace app\admin\controller\wechat;
- use app\common\controller\Backend;
- use app\common\library\Redis;
- use app\main\constants\AdminConstants;
- use app\main\constants\CacheConstants;
- use app\main\constants\ErrorCodeConstants;
- use app\main\constants\SubscribeDelayConstants;
- use app\main\service\AdminService;
- use app\main\service\ReplyVipService;
- use app\main\service\SubscribeVipDelayService;
- use app\main\service\UrlService;
- class Vipsignreply extends Backend
- {
- protected $noNeedRight = ['index'];
- public function index()
- {
- $where = [
- 'admin_id' => $this->auth->id,
- 'title' => '签到',
- ];
- $find = model('wechat_autoreply')->where($where)->find();
- if ($this->request->isPost()) {
- $data = json_decode($this->request->param('data'), true);
- $result = ReplyVipService::instance()->createSignReply($data, $this->auth->id);
- if ($result->code == ErrorCodeConstants::SUCCESS) {
- $this->success();
- } else {
- $this->error($result->msg);
- }
- }
- if ($find && $find['text_content'] != '') {
- $data = json_decode($find['text_content'], true);
- if ($data['deploy_type'] == SubscribeDelayConstants::VIP_DEPLOY_GROUP) {
- $groupList = model('vip_group')->whereIn('id', $data['admin_group'])->column('id,id,name,createtime,updatetime');
- foreach($data['admin_group'] as $groupId){
- if (array_key_exists($groupId, $groupList)) {
- $data['selected'][$groupId] = $groupList[$groupId];
- }
- }
- }
- if ($find['status'] == 'hidden') {
- $data['text'] = '[]';
- $data['type'] = 1;
- }
- } else {
- $data = [
- 'text' => '[]',
- 'type' => 1,
- 'text_split' => '',
- ];
- }
- $this->assignconfig($data);
- return $this->view->fetch();
- }
- }
|