微信營銷活動

微信開發中的營銷活動

微信營銷活動推廣,在公衆號中一般用於設置菜單,也適用於消息的推送,也用於消息的回覆。除消息推送屬於主動響應外,其他則屬於被動消息響應。被動響應則由一套關鍵字系統服務,當用戶發送關鍵字到服務器,則觸發響應的事件,服務器則以http的方式響應用戶。
下面具體介紹一下關鍵字系統:

  • 關鍵詞系統
    1.信息結構
CREATE TABLE `custom_keyword` (  
    `aid` int(11) unsigned NOT NULL COMMENT '公衆號id',  
    `business_id` int(11) unsigned NOT NULL COMMENT '商戶id',  
    `plc_sourceid` varchar(50) NOT NULL COMMENT '公衆賬號原始id',  
    `group_id` int(11) unsigned NOT NULL COMMENT '規則分組', 
    `custom_reply_id` varchar(64) NOT NULL COMMENT '回覆內容id',  
    `ktag` varchar(50) NOT NULL COMMENT '關鍵詞tag',  
    `match_type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '匹配類型:1全配 2模糊',  
    `reply_type` smallint(6) NOT NULL DEFAULT '1' COMMENT '回覆類型:1文本 2圖文 3音樂',  
    `is_hiden` smallint(6) NOT NULL DEFAULT '0' COMMENT '0顯示大於零隱藏 1關注時回覆 2活動時回覆',  
    `ctime` int(11) NOT NULL COMMENT '創建時間',  
    `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1刪除標誌',  
    UNIQUE KEY `uindex_b_p_k` (`business_id`,`plc_sourceid`,`ktag`),  
    UNIQUE KEY `uindex_a_k` (`aid`,`ktag`),  
    KEY `i_aid_group_id` (`aid`,`group_id`),  
    KEY `i_business_id_plc_sourceid_group_id` (`business_id`,`plc_sourceid`,`group_id`),  
    KEY `i_aid` (`aid`),  
    KEY `i_business_id_plc_sourceid` (`business_id`,`plc_sourceid`) 
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='關鍵字tags列表';

2.工作流程圖

關鍵詞工作流程圖
圖1-1 關鍵詞系統工作流圖

  • 用戶狀態系統
    1.信息結構
 CREATE TABLE `userlisten

 - 列表內容

` (  
     `aid` int(11) unsigned NOT NULL COMMENT '公衆賬號id',  
     `wechat_id` varchar(50) NOT NULL COMMENT '用戶openid',  
     `modules` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '模塊',  
     `status` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '模塊狀態',  
     `reply_appid` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '回覆的應用id',  
     `reply_type` smallint(6) unsigned NOT NULL DEFAULT '0' COMMENT '回覆類型',  
     `utime` int(11) unsigned NOT NULL COMMENT '更新時間',  
     `ctime` int(11) unsigned NOT NULL COMMENT '創建時間',  
     `flag` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '刪除標誌',  
     UNIQUE KEY `unique_a_wechat_id` (`aid`,`wechat_id`) 
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

2.工作流程圖

用戶狀態工作流程圖
圖1-2 用戶狀態工作流圖

結論:所有營銷活動,都與關鍵詞系統有關,涉及到圖文回覆、素材管理(微信素材管理、第三方素材管理),前端頁面展示相關的活動,經由js處理,將結果反饋給服務器,形成用戶與服務器(微信-第三方)的交互。

微信牆

微信牆需求原型:
微信牆原型圖
微信牆原型圖

標題用於顯示在大屏幕上,關鍵詞用於用戶觸發該微信牆。
這裏是有一篇關於微信牆的文章,介紹很詳細,《微信牆怎麼弄》
根據需求,首先是把所有的微信牆在後臺顯示出來(也可以帶query查詢,query數據以post形式發送):

public function actionIndex(){
    $aid = intval(Yii::app()->request->getParam('aid));
    $cret = Wechat::model()->getPlcaccount(array('id' => $aid, 'business_id' => $this->sdid));
    $size = 12;
    $page = intval(Yii::app()->request->getParam('page',1));
    $aCondition = array('business_id' => $this->sdid
, 'plc_sourceid' => $cret['plc_sourceid']);
    if($_GET['keywords']){
        $keywords = filterString($_GET['keywords']);
        $aCondition['keyword'] = array('op'=>'LIKE', 'val' = "%$keywords%");
    }
    $data = Wall::model()->getWall($page,$size,$aCondition,'wall');
    $this->assign('data',$data);
    $this->addCss('bootstrap_min','bootstrap_responsive_min','style','todc_bootstrap','themes','inside');
    $this->addScript('bootstrap_min','inside','plugins.daterangepicker.moment_min');
    $this->assign('aid',$aid);
    $this->display('index');
}

對index操作中的變量及函數說明:
aid是公衆號託管到第三方系統中生成的id,屬於第三方數據庫字段,不屬於微信服務器數據字段,也就是綁定公衆號時生成的id
sdidbusiness_id是商戶註冊第三方服務時生成的賬戶id
size,page是分頁函數用到的參數,分別表示大小,頁數
plc_sourceid是公衆號原始id,可以登錄微信後臺,在公衆號設置中可以查詢到。

編輯微信牆:

public function actionEdit() {

    if(empty($_POST)) {
        $aid = (int)Yii::app()->request->getParam('aid');
        $id = (int)Yii::app()->request->getParam('id');
        $cret = Wechat::model()->getPlcaccount(array('id' => $aid, 'business_id' => $this->sdid));
    $arr = array(
    //'plc_sourceid'=>$cret['plc_sourceid'],
    //'business_id' => $this->sdid,
    'pid' => $aid,
    'status' => 1,
    'lt' => array('start_time' => date('Y-m-d H:i:s')),
    'gt' => array('end_time' => date('Y-m-d H:i:s'))
    //'start_time' => array('op'=>'<', val=>time()),
    //'end_time' => array('op'=>'>', val=>time())
    );
    /*讀取投票活動的信息*/
    //$act_vote = activity::model()->getVote(1, 10, $arr);

    $act_vote = Vote::model()->getVoteList($arr,1,10);
        $this->assign('act_vote', $act_vote);
        $this->addCss('bootstrap_min', 'bootstrap_responsive_min', 'style', 'todc_bootstrap_button', 'themes', 'plugins.uploadify.uploadify_t', 'plugins.daterangepicker.daterangepicker', 'inside');
        $this->addScript('bootstrap_min', 'plugins.validation.jquery_validate_min', 'plugins.validation.jquery_validate_methods', 'plugins.form.jquery_form_min', 'jquery_ui_custom', 'plugins.uploadify.jquery_uploadify', 'plugins.mini_audio_player.jquery_jplayer_min', 'plugins.mini_audio_player.jquery_mb_miniPlayer', 'plugins.zeroclipboard.zeroclipboard_min', 'plugins.datepicker.bootstrap-datepicker', 'plugins.daterangepicker.moment_min', 'plugins.daterangepicker.daterangepicker', 'inside');
        $this->assign('aid', $aid);
        $this->assign('md5', $this->md5);
        if($id) {
            $wall = Wall::model()->getOneWall(array('id'=>$id, 'business_id'=>$this->sdid, 'plc_sourceid'=>$cret['plc_sourceid']), 'Wall');
            if(1 == $wall['photo']) {
                $wall_photo = Wall::model()->getOneWall(array('photo_id'=>$id, 'business_id'=>$this->sdid, 'plc_sourceid'=>$cret['plc_sourceid']), 'WallPhoto');
            }
            if(1 == $wall['bigwheel']) {
                $wall_bigwheel = Wall::model()->getOneWall(array('bigwheel_id'=>$id, 'business_id'=>$this->sdid, 'plc_sourceid'=>$cret['plc_sourceid']), 'Wallbigwheel');
                $wall_bigwheel['bigwheel_option'] = json_decode($wall_bigwheel['bigwheel_option'], true);
            }
            if(1 == $wall['lottery']) {
                $wall_lottery = Wall::model()->getOneWall(array('lottery_id'=>$id, 'business_id'=>$this->sdid, 'plc_sourceid'=>$cret['plc_sourceid']), 'WallLottery');
                $wall_lottery['lottery_option'] = json_decode($wall_lottery['lottery_option'], true);
            }
            if(1 == $wall['vote']) {
                $wall_vote = Wall::model()->getOneWall(array('vote_id'=>$id, 'business_id'=>$this->sdid, 'plc_sourceid'=>$cret['plc_sourceid']), 'WallVote');
            }
            if(1 == $wall['race']) {
                $wall_race = Wall::model()->getOneWall(array('race_id'=>$id, 'business_id'=>$this->sdid, 'plc_sourceid'=>$cret['plc_sourceid']), 'WallRace');
            }
    //簽到牆
    if(1 == $wall['has_signin']){
        $wall_signin = array();
    }
    //搶紅包
    if(1 == $wall['has_red_packet']){
        $wall_red = Wall::model()->getAllDataInfo('{{wall_red_packet}}',array("pid"=>$aid,"wall_id"=>$id,"flag"=>0)," sequence asc ");
        $sequence_valid_minute_other = 0;
        $game_valid_second_other = 0;
        foreach($wall_red as $key => $info){
        $sequence_valid_minute = (int) $info['sequence_valid_minute'];
        if($sequence_valid_minute != 1 && $sequence_valid_minute != 5 && $sequence_valid_minute != 10){
            $sequence_valid_minute_other = $sequence_valid_minute;
            $sequence_valid_minute = 0;
        }
        $game_valid_second = (int) $info['game_valid_second'];
        if($game_valid_second != 10 && $game_valid_second != 20 && $game_valid_second != 60){
            $game_valid_second_other = $game_valid_second;
            $game_valid_second = 0;
        }
        $valid_type = $info['valid_type'];
        $valid_end_time = $valid_type == 1 ? date('Y-m-d',strtotime($info['valid_end_time'])) : '';
        $valid_day = $info['valid_day'];
        $name  = $info['name'];
        $wall_red[$key]['enumeration_money'] = !empty($info['enumeration_money']) ? json_decode($info['enumeration_money']) : array('');
        }
    }

            /*讀取相冊數據*/
            $albums = Albums::model()->GetPictureListByAlbumsId($cret['plc_sourceid'],$this->sdid,$wall_photo['albums_id']);
            $this->assign('wall', $wall);
            $this->assign('albums', $albums);
            $this->assign('wall_photo', $wall_photo);
            $this->assign('wall_bigwheel', $wall_bigwheel);
            $this->assign('wall_lottery', $wall_lottery);
            $this->assign('wall_vote', $wall_vote);
            $this->assign('wall_race', $wall_race);
    $this->assign('wall_red',$wall_red);
    $this->assign('sequence_valid_minute_other',$sequence_valid_minute_other);
    $this->assign('game_valid_second_other',$game_valid_second_other);
    $this->assign('sequence_valid_minute',$sequence_valid_minute);
    $this->assign('game_valid_second',$game_valid_second);
    $this->assign('valid_type',$valid_type);
    $this->assign('valid_end_time',$valid_end_time);
    $this->assign('valid_day',$valid_day);
    $this->assign('name',$name);
            $this->assign('business_id',$this->sdid);
            $this->assign('id', $id);
            $this->display('edit');
        } else {
            $this->display('add');
        }
    } else {
        $_POST = filterString($_POST); // 參數過濾
        $id = $_POST['id'];
        $aid = $_POST['aid'];
        $cret = Wechat::model()->getPlcaccount(array('id' => $aid, 'business_id' => $this->sdid));
        $_POST['business_id'] = $this->sdid;
        $_POST['plc_sourceid'] = $cret['plc_sourceid'];
        $time = explode('-',$_POST['time']);
        $_POST['start_time'] = strtotime(trim($time[0]));
        $_POST['end_time'] = strtotime(trim($time[1]));

        empty($_POST['title']) ? $_POST['title'] = '微信牆' : $_POST['title'] = $_POST['title'];
        empty($_POST['photo_name']) && 1 == $_POST['photo'] ? $_POST['photo_name'] = '照片' : $_POST['photo_name'] = $_POST['photo_name'];
        empty($_POST['bigwheel_name']) && 1 == $_POST['bigwheel'] ? $_POST['bigwheel_name'] = '大轉盤' : $_POST['bigwheel_name'] = $_POST['bigwheel_name'];
        empty($_POST['lottery_name']) && 1 == $_POST['lottery'] ? $_POST['lottery_name'] = '抽獎' : $_POST['lottery_name'] = $_POST['lottery_name'];
        empty($_POST['vote_name']) && 1 == $_POST['vote'] ? $_POST['vote_name'] = '投票' : $_POST['vote_name'] = $_POST['vote_name'];
        empty($_POST['play_audio']) ? $_POST['play_audio']=0 : '';
        empty($_POST['photo']) ? $_POST['photo']=0 : '';
        empty($_POST['bigwheel']) ? $_POST['bigwheel']=0 : '';
        empty($_POST['lottery']) ? $_POST['lottery']=0 : '';
        empty($_POST['vote']) ? $_POST['vote']=0 : '';
        empty($_POST['race']) ? $_POST['race']=0 : '';

    $envelope = (int) Yii::app()->request->getPost('has_red_packet',0);

        if(1 == $_POST['bigwheel'] && !empty($_POST['bigwheel_keyword'])) $kword[] = $_POST['bigwheel_keyword'];
        if(1 == $_POST['lottery'] && !empty($_POST['lottery_keyword'])) $kword[] = $_POST['lottery_keyword'];
        if(1 == $_POST['vote'] && !empty($_POST['vote_keyword'])) $kword[] = $_POST['vote_keyword'];
        if(1 == $_POST['race'] && !empty($_POST['paoma_keyword'])) $kword[] = $_POST['paoma_keyword'];
        if(1 == $_POST['race'] && !empty($_POST['race_keyword'])) $kword[] = $_POST['race_keyword'];

    if($envelope == 1){
    $kword[] = Yii::app()->request->getPost('red_packet_key_word');
    }
        $iskword = 0;
        $syskeyword = array('0','1'); //系統關鍵字
        /* 檢測關鍵字是否重複 */
        foreach ($kword as $k => $v) {
            if(in_array($v, $syskeyword)){
                echo '“'.$v.'”是系統關鍵字,請重新輸入!';exit();
            }
            foreach ($kword as $ki => $vi) {
                if($k == $ki+1){
                    continue;
                } elseif($kword[$k] == $kword[$ki+1]) {
                    $iskword = 1;
                }
            }
        }
        if ($iskword == 1) {
            echo '關鍵字重複!';exit();
        }
        if(1 == $_POST['race']) {
            if(1 == $_POST['race_num'] && $_POST['race_option']) {
                $waste = array();
                /* 根據頁面樣式查找需要過濾的key*/
                foreach ($_POST['race_option']['sort'] as $k => $v) {
                    $i = $k*3;
                    $waste[] = $i+1;
                    $waste[] = $i+2;
                }
                /* 過濾key*/
                foreach ($waste as $k => $v) {
                    unset($_POST['race_option']['type'][$v]);
                    unset($_POST['race_option']['picurl'][$v]);
                    unset($_POST['race_option']['title'][$v]);
                }
                /* 對過濾後的數組重新索引*/
                $_POST['race_option']['type'] = array_values($_POST['race_option']['type']);
                $_POST['race_option']['picurl'] = array_values($_POST['race_option']['picurl']);
                $_POST['race_option']['title'] = array_values($_POST['race_option']['title']);
            }
            $req = Wall::model()->arrayRequired($_POST['race_option']);
            if(false === $req){
                echo '“搖一搖跑馬”添加獎項不能爲空';exit();
            }
        }

    //紅包強邏輯
    if($envelope == 1){
    $red_packet_name = Yii::app()->request->getPost('name','');//紅包活動名稱
    $sequence_valid_minute =  (int) Yii::app()->request->getPost('sequence_valid_minute',10);//紅包活動固定時間
    $sequence_valid_minute_other = (int) Yii::app()->request->getPost('sequence_valid_minute_other');//其他時間
    $game_valid_second = (int) Yii::app()->request->getPost('game_valid_second',10);//搶紅包時間
    $game_valid_second_other = (int) Yii::app()->request->getPost('game_valid_second_other');//其他時間
    $valid_type = (int) Yii::app()->request->getPost('valid_type',1);//有效期類型
    $valid_end_time = Yii::app()->request->getPost('valid_end_time','0000-00-00 00:00:00');//絕對有效期
    $valid_day = (int)Yii::app()->request->getPost('valid_day',0);//相對有效期
    $balance = Yii::app()->request->getPost('balance');//預算
    $money_type = Yii::app()->request->getPost('money_type');//紅包金額類型
    $fixed_money = Yii::app()->request->getPost('fixed_money');//固定金額
    $random_max_money = Yii::app()->request->getPost('random_max_money');//隨機金額
    $enumeration_money = Yii::app()->request->getPost('enumeration_money');//相隨隨機金額
    $red_packet_id = Yii::app()->request->getPost('red_packet_id');//紅包輪數主鍵
    $red_packet_did = Yii::app()->request->getPost('red_packet_did');//被刪除紅包輪數
    foreach($balance as $key => $value){
        $type = $money_type[$key];//紅包金額類型
        if($type < 3){
        continue;
        } else if($type == 3){
        $emoney = array();
        foreach($enumeration_money[$key] as $number => $money){
            $emoney[] = number_format($money,2,'.',',');
        }
        $enumeration_money[$key] = json_encode($emoney);
        } else {
        echo '紅包數據異常';exit();
        }
    }
    }

        if(empty($id)) {
            /*校驗關鍵字是否重複*/
            $arr = KeywordReply::model()->checkKeyTags($_POST['keyword'], $this->sdid, $cret['plc_sourceid']);
            if($arr) {
                echo '關鍵詞重複,請重新輸入!';exit();
            }
            $ret = Wall::model()->addWall($_POST, 'Wall');
            /*插入關鍵字*/
            $key = KeyWordReply::model()->addKeyTags($_POST['keyword'], $ret, $this->sdid, $cret['plc_sourceid'], '201');
            $id = $ret;
        } else {
            if(0 == $_POST['examine']){
                Wall::model()->updateWall(array('audit'=>0), array('wallid'=>$id,'plc_sourceid'=>$cret['plc_sourceid'], 'business_id'=>$this->sdid), 'WallUser');
            }
            //刪除舊關鍵詞
            $tag_del = KeywordReply::model()->delKtag(array('business_id' => $this->sdid, 'plc_sourceid' =>$cret['plc_sourceid'], 'custom_reply_id' => $id,'reply_type'=>201));
            /*校驗關鍵字是否重複*/
            $arr = KeywordReply::model()->checkKeyTags($_POST['keyword'], $this->sdid, $cret['plc_sourceid']);
            if($arr) {
                echo '關鍵詞重複,請重新輸入!';exit();
            }
            $aWhere = array('id'=>$id, 'plc_sourceid'=>$cret['plc_sourceid'], 'business_id'=>$this->sdid);
            $ret = Wall::model()->updateWall($_POST, $aWhere, 'Wall');
            /*插入關鍵字*/
            $key = KeyWordReply::model()->addKeyTags($_POST['keyword'], $id, $this->sdid, $cret['plc_sourceid'], '201');
        }
        if ($this->check($ret)) {
            echo '編輯失敗';exit();
        }
        /* 附表操作*/
        if(1 == $_POST['photo']) {
            $_POST['photo_id'] = $id;
            $albums_arr = array();
            $albums_arr['photoid'] = $_POST['phout_list'];
            $albums_arr['url'] = $_POST['phout_url'];
            $albums_arr['title'] = $_POST['imagestexts'];
            $albums_arr['description'] = array();
            if($albums_arr) {
                $result = Albums::model()->SavePictureByAlbumsId($albums_arr,$cret['plc_sourceid'],$this->sdid,$_POST['albums_id']);
            }
            $wall_photo = Wall::model()->getOneWall(array('photo_id'=>$id, 'business_id'=>$this->sdid, 'plc_sourceid'=>$cret['plc_sourceid']), 'WallPhoto');
            if(empty($wall_photo)){
                $photo = Wall::model()->addWall($_POST, 'WallPhoto');
            }else{
                $photo = Wall::model()->updateWall($_POST, array('photo_id'=>$id,'plc_sourceid'=>$cret['plc_sourceid'], 'business_id'=>$this->sdid), 'WallPhoto');
            }
        }
        if(1 == $_POST['bigwheel']) {
            $_POST['bigwheel_id'] = $id;
            $req = Wall::model()->arrayRequired($_POST['bigwheel_option']);
            if(false === $req){
                echo '“大轉盤”添加獎項不能爲空';exit();
            }
            $_POST['bigwheel_option'] = json_encode($_POST['bigwheel_option']);
            $wall_bigwheel = Wall::model()->getOneWall(array('bigwheel_id'=>$id, 'business_id'=>$this->sdid, 'plc_sourceid'=>$cret['plc_sourceid']), 'Wallbigwheel');
            if(empty($wall_bigwheel)){
                $bigwheel = Wall::model()->addWall($_POST, 'Wallbigwheel');
            }else{
                $bigwheel = Wall::model()->updateWall($_POST, array('bigwheel_id'=>$id,'plc_sourceid'=>$cret['plc_sourceid'], 'business_id'=>$this->sdid), 'Wallbigwheel');
            }
        }
        if(1 == $_POST['lottery']) {
            $_POST['lottery_id'] = $id;
            $req = Wall::model()->arrayRequired($_POST['lottery_option']);
            if(false === $req){
                echo '“抽獎”添加獎項不能爲空';exit();
            }
            $_POST['lottery_option'] = json_encode($_POST['lottery_option']);
            $wall_lottery = Wall::model()->getOneWall(array('lottery_id'=>$id, 'business_id'=>$this->sdid, 'plc_sourceid'=>$cret['plc_sourceid']), 'WallLottery');
            if(empty($wall_lottery)){
                $lottery = Wall::model()->addWall($_POST, 'WallLottery');
            }else{
                $lottery = Wall::model()->updateWall($_POST, array('lottery_id'=>$id,'plc_sourceid'=>$cret['plc_sourceid'], 'business_id'=>$this->sdid), 'WallLottery');
            }
        }
        if(1 == $_POST['vote']) {
            $_POST['vote_id'] = $id;
            $wall_vote = Wall::model()->getOneWall(array('vote_id'=>$id, 'business_id'=>$this->sdid, 'plc_sourceid'=>$cret['plc_sourceid']), 'WallVote');
            if(empty($wall_vote)){
                $vote = Wall::model()->addWall($_POST, 'WallVote');
            } else {
                $vote = Wall::model()->updateWall($_POST, array('vote_id'=>$id,'plc_sourceid'=>$cret['plc_sourceid'], 'business_id'=>$this->sdid), 'WallVote');
            }
        }
        if(1 == $_POST['race']){
            $_POST['race_id'] = $id;

            $_POST['race_option'] = json_encode($_POST['race_option']);
            $wall_race = Wall::model()->getOneWall(array('race_id'=>$id, 'business_id'=>$this->sdid, 'plc_sourceid'=>$cret['plc_sourceid']), 'WallRace');
            if(empty($wall_race)){
                $race = Wall::model()->addWall($_POST, 'WallRace');
            } else {
                $race = Wall::model()->updateWall($_POST, array('race_id'=>$id,'plc_sourceid'=>$cret['plc_sourceid'], 'business_id'=>$this->sdid), 'WallRace');
            }
        }
    //紅包
    if(1 == $envelope){
    //更新活動

    if(is_array($balance) && !empty($balance)){
        $sequence = 1;
        foreach($balance as $balance_key => $balance_money){
        $params = array();
        $params['pid'] = $aid;
        $params['wall_id'] = $id;
        $params['sequence'] = $sequence;
        $params['name'] = $red_packet_name;
        $params['sequence_valid_minute'] = $sequence_valid_minute == 0 ? (int) $sequence_valid_minute_other : (int) $sequence_valid_minute;
        $params['game_valid_second'] = $game_valid_second == 0 ? (int) $game_valid_second_other : (int) $game_valid_second;
        $params['balance'] = $balance_money;
        $params['money'] = isset($fixed_money[$balance_key]) ? $fixed_money[$balance_key] : 0.00;
        $params['random_min_money'] = 0.01;
        $params['random_max_money'] = isset($random_max_money[$balance_key]) ? $random_max_money[$balance_key] : 0.00;
        $params['enumeration_money'] = isset($enumeration_money[$balance_key]) ? $enumeration_money[$balance_key] : 0.00;
        $params['valid_type'] = $valid_type;
        $params['valid_end_time'] = empty($valid_end_time) ? '0000-00-00 00:00:00' : date('Y-m-d 23:59:59',strtotime($valid_end_time));
        $params['valid_day'] = $valid_day;
        if(isset($red_packet_id[$balance_key])){
            $where = array(
                'pid' => $aid,
                /*'sequence_status' => 0,*/
                'id' => (int) $red_packet_id[$balance_key]
            );
            Wall::model()->updateDataInfo('{{wall_red_packet}}',$params,$where);
        } else {
            $params['money_type'] = $money_type[$balance_key];
            $params['flag'] = 0;
            $params['sequence_status'] = 0;
            $params['create_time'] = date('Y-m-d H:i:s');
            Wall::model()->insertDataInfo('{{wall_red_packet}}',$params);
        }
        $sequence++;
        }
        $red_packet_info = Wall::model()->getAllDataInfo('{{wall_red_packet}}',array('pid'=>$aid,'wall_id'=>$id, 'flag' => 0)," sequence asc");
        $rd = EasyRedis::getInstance('wall');
        $red_key = "{$aid}_{$id}_sequencelist";
        $rd->hSet($red_key,$id,json_encode($red_packet_info));
    }
    //刪除活動
    if(!empty($red_packet_did)){
        $red_packet_did = explode(',',$red_packet_did);
        foreach($red_packet_did as $del_id){
        if(!empty($del_id) && $del_id > 0){
            Wall::model()->updateDataInfo('{{wall_red_packet}}',array('flag'=>1),array('pid'=>$aid,'id'=>$del_id));
        }
        }
    }
    }

        echo json_encode(array('errno'=>'0','error'=>'編輯成功!','url' =>'/Wewall/Index?aid='.$aid));
        return ;
    }
    }

微渠道

點球大戰

鵲橋相會

大轉盤

優惠劵

刮刮卡

老版聖誕活動

一戰到底

砸金蛋

2048

暖男躲避戰

聖誕活動

瘋狂划算

拆禮盒

彩票推廣

紅包

全民經紀人

新年活動

微助力

童年回憶

設計原型

這裏寫圖片描述
這裏寫圖片描述
這裏寫圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章