Userevaluation.php 2.76 KB
<?php


namespace app\admin\controller;


class Userevaluation extends Base
{

    public function index()
    {
        $stoid=getAdmStoId();
        $type=I("type",1);
        $this->assign("type",$type);
        $is_ajax=I("is_ajax");
        $list=M("marketing_comments_reward")->where("store_id",$stoid)->where("type",$type)->find();
        $this->assign("list",$list);
        //---保存的操作---
        if($is_ajax){
           $data=I("post.");
           $data['begindate']=strtotime( $data['begindate']);
           $data['enddate']=strtotime($data['enddate']);

           $str="";
           if($data['condition1']) $str=",1,";
           if($data['condition2']) $str="2,";
           if($str)  $data['sendconditions']=$str;
            $data['gifbagid']=(int)$data['gifbagid'];
           if($list){
               M("marketing_comments_reward")->where("id",$list['id'])->save($data);
           }else{
               $data['store_id'] =$stoid;
               M("marketing_comments_reward")->save($data);
           }
           $this->success("保存成功");
        }
        //礼包数据
        $lblist = M('marketing_libao_form')->where(array('store_id' => $stoid, 'is_act' => 1))->select();
        $this->assign('lblist', $lblist);

        $this->initEditor(); // 编辑器
        return $this->fetch('', getAdmStoId());
    }

    //评价领取记录
    public function receive()
    {
        return $this->fetch('', getAdmStoId());
    }

    /**
     * 初始化编辑器链接
     * 本编辑器参考 地址 http://fex.baidu.com/ueditor/
     */
    private function initEditor()
    {
        $this->assign("URL_upload", U('Admin/Ueditor/imageUp', array('savepath' => 'userevaluation', 'savepath1' => strtolower(getERPId()))));
        $this->assign("URL_fileUp", U('Admin/Ueditor/fileUp', array('savepath' => 'userevaluation', 'savepath1' => strtolower(getERPId()))));
        $this->assign("URL_scrawlUp", U('Admin/Ueditor/scrawlUp', array('savepath' => 'userevaluation', 'savepath1' => strtolower(getERPId()))));
        $this->assign("URL_getRemoteImage", U('Admin/Ueditor/getRemoteImage', array('savepath' => 'userevaluation', 'savepath1' => strtolower(getERPId()))));
        $this->assign("URL_imageManager", U('Admin/Ueditor/imageManager', array('savepath' => 'userevaluation', 'savepath1' => strtolower(getERPId()))));
        $this->assign("URL_imageUp", U('Admin/Ueditor/imageUp', array('savepath' => 'userevaluation', 'savepath1' => strtolower(getERPId()))));
        $this->assign("URL_getMovie", U('Admin/Ueditor/getMovie', array('savepath' => 'userevaluation', 'savepath1' => strtolower(getERPId()))));
        $this->assign("URL_Home", "");
    }

    //动态查询数据
    public function ajaxindex()
    {
        return $this->fetch('', getAdmStoId());
    }

}