コード例 #1
0
ファイル: index.php プロジェクト: songhongyu/idaiyan
" class="tabitem tab1 fl">
                    <div class="tab_img">
                <?php 
                if (isset($val['mark'])) {
                    ?>
                        <?php 
                    if ($val['mark'] == 'baiying') {
                        ?>
                        <?php 
                        $mBaiyingShare = new BaiyingShare();
                        $number = $mBaiyingShare->getShareNum($val['id']);
                        $over = isset($number) ? intval($number) : 0;
                        $rel_id = isset($val['id']) ? $val['id'] : '';
                        $act_id = isset($val['acti_id']) ? $val['acti_id'] : '';
                        $model = new ActivityProductAttrVal();
                        $attr = $model->getRealAttrVals($rel_id, $act_id);
                        // $attr = $model->getRealAttrVals(32831,8);
                        $limit_people_num = isset($attr['limit_people_num']['val']) ? $attr['limit_people_num']['val'] : 0;
                        $supply_num = isset($attr['supply_num']['val']) ? $attr['supply_num']['val'] : 0;
                        $total = $limit_people_num * $supply_num;
                        $step2 = 0;
                        if ($total !== 0) {
                            $tmp = $over / $total;
                            $step2 = 100 * round($tmp, 2);
                        }
                        ?>
                        <div class="text" data-tip="<a href='<?php 
                        echo Yii::$app->getUrlManager()->createUrl(['product/view', 'id' => $product['id']]);
                        ?>
'><?php 
                        echo isset($val['subject']) ? $val['subject'] : 0;
コード例 #2
0
 /**
  * 改变中国好产品 状态,并添加进投票项
  * @param int $id 活动产品id
  * @param int $status 活动产品状态
  *
  * @return json
  * */
 public function actionStatus()
 {
     $admin = Yii::$app->util->isAdminLogin();
     if (!$admin && !Yii::$app->util->isAjax()) {
         echo Yii::$app->util->formatResEncode('1001', 'login error');
         exit;
     }
     $params = Yii::$app->request->post();
     $rel_id = isset($params['id']) ? intval($params['id']) : '';
     $status = isset($params['status']) ? intval($params['status']) : '';
     if (empty($rel_id) || empty($status)) {
         echo Yii::$app->util->formatResEncode('1002', 'param error');
         exit;
     }
     $mActivityProduct = new ActivityProduct();
     $actproduct = $mActivityProduct->getDetailBypk($rel_id);
     $product = $actproduct['product']['name'];
     if ($mActivityProduct->changeStatus($rel_id, $status)) {
         $msg = '产品:' . $product . '状态更改成功!';
         //审核通过 增加投票项
         if ($status == ActivityProduct::STATUS_VERIFY_THROUGH) {
             $mapattrval = new ActivityProductAttrVal();
             $attrval = $mapattrval->getRealAttrVals($rel_id, ActivityBase::GOOD_PRODUCT);
             $city = $attrval['division']['val'];
             $poll_type_id = PollType::GOODPRODUCT_TYPE;
             $mpoll = new poll();
             $pollone = $mpoll->getPollByCity($city, $poll_type_id);
             if ($pollone) {
                 $option = ['poll_id' => $pollone['poll_id'], 'owner_id' => $rel_id, 'option_name' => $product, 'option_type_id' => ActivityBase::GOOD_PRODUCT];
                 $mpolloption = new PollOption();
                 //判断该活动产品 是否已经添加进去投票项
                 $isoption = $mpolloption->isOptionRel($option);
                 if (!$isoption) {
                     $option_id = $mpolloption->storeSave($option);
                     if ($option_id) {
                         if (!strpos($pollone['poll_option_ids'], $rel_id)) {
                             $mpoll = new poll();
                             $ids = empty($pollone['poll_option_ids']) ? $rel_id : $pollone['poll_option_ids'] . ',' . $rel_id;
                             $mpoll->storeSave(['poll_id' => $pollone['poll_id'], 'poll_option_ids' => $ids]);
                         }
                         $option_id ? $msg .= ',添加成为投票项' : '';
                     }
                 }
             }
         }
         echo Yii::$app->util->formatResEncode('0', $msg);
     } else {
         echo Yii::$app->util->formatResEncode('1003', '更改失败!');
     }
 }
コード例 #3
0
 /**
  * [一呼百应活动宣传主题页]
  * @param  [int] $uid [产品id]
  * 本地地址:http://www.idaiyan-website.cn/special-topic/yihubaiying201503
  * 线上地址:http://test.idaiyan.cn/special-topic/yihubaiying201503
  */
 public function actionYihubaiying201503()
 {
     //获取产品列表数据
     $page = Yii::$app->request->get('page', 1);
     $page = intval($page);
     $mactpro = new ActivityProduct();
     $date = $mactpro->getActProductListpage($page, false, ActivityProduct::PAGE_SIZE_SPECIAL);
     $pages = new Pagination(['totalCount' => $date->count(), 'pageSize' => ActivityProduct::PAGE_SIZE_SPECIAL]);
     $productlist = $date->asArray()->all();
     //取得属性
     $mapattrval = new ActivityProductAttrVal();
     if ($productlist) {
         foreach ($productlist as $pl => $st) {
             $acprattr = $mapattrval->getRealAttrVals($st['id'], ActivityBase::APPLY_BAIYING);
             $productlist[$pl]['attr'] = $acprattr;
         }
     }
     // echo "<pre>";
     // var_dump($productlist);die;
     if ($page > 1) {
         $more = '';
         foreach ($productlist as $key => $val) {
             $priceimg = isset($val['attr']['discount_price']['val']['priceimg']) ? Yii::$app->params['idaiyan'] . '/' . $val['attr']['discount_price']['val']['priceimg'] . '.jpg' : Yii::$app->params['idaiyan-static'] . 'static/modules/home/images/nopic.jpg';
             $pname = isset($val['product']['name']) ? $val['product']['name'] : '';
             $url = Url::toRoute(['product/view', 'id' => $val['product_id']]);
             $data_url = Yii::$app->params['idaiyan'] . Url::toRoute(['baiying/productdetial', 'rel_id' => $val['id']]);
             $more .= "<li><a href='{$url}'> ";
             if ($priceimg) {
                 $more .= "<img src='" . $priceimg . "' alt='" . $pname . "'>";
             } else {
                 $more .= "<img src='" . Yii::$app->params['idaiyan-static'] . "static/modules/home/images/nopic.jpg' alt=''>";
             }
             $more .= "<div class='products'><div class='title'>" . $pname . "</div><div class='qrcode_logo'>\r\n                <div class='QR_code' data-url='{$data_url}'><img src= '" . Yii::$app->params['idaiyan-static'] . "static/modules/home/images/temp/QR_code.png'></div>\r\n                        </div>\r\n                    </div></a></li>";
         }
         //$jsmore =  array(
         //  'code' => 0,
         //'msg' => 'success',
         // 'data' => $more,
         // );
         // echo json_encode($jsmore);
         echo PublicLibrary::format_res_encode('0', 'success', $more);
         exit;
     }
     //var_dump($productlist);die;
     $this->layout = false;
     //调用个人中心的布局
     return $this->render('yihubaiying201503', ['productlist' => $productlist]);
     exit;
 }
コード例 #4
0
 /**
  * @author shimeixia <*****@*****.**>
  * @param $pid 产品id
  * @param $aid 活动id
  *
  * @return
  */
 public function actionApplybaiyingDiy()
 {
     $user = PublicLibrary::is_login() ? PublicLibrary::is_login() : $this->redirect(['user/login']);
     $parr = Yii::$app->request->get();
     $pid = isset($parr['pid']) ? intval($parr['pid']) : '';
     $aid = intval(ActivityBase::APPLY_BAIYING);
     if (empty($pid) || empty($aid)) {
         return $this->redirect(['home-page/lists', 'uid' => $user['uid']]);
         //跳转到完善信息
     }
     //判断是否存在该活动
     $mActiBase = new ActivityBase();
     $activity = $mActiBase->pk($aid);
     if (!$activity) {
         return $this->redirect(['home-page/lists', 'uid' => $user['uid']]);
         //跳转到用户主页
     }
     //查询是不是该用户发布的产品
     $model = new IProductBase();
     $res = $model->isMyProduct($user['uid'], $pid);
     if (!$res) {
         return $this->redirect(['home-page/lists', 'uid' => $user['uid']]);
         //跳转到用户主页
     }
     //$session->set('acti_config', $activity['config']);
     //查询该商品有没有参加过该活动
     $mactivitypdt = new ActivityProduct();
     $one = $mactivitypdt->isinActivity($user['uid'], $aid, $pid);
     //$one = $mactivitypdt ->applyWay($user['uid'],$aid,$pid,0);
     // echo '<pre>';
     // var_dump($one);die;
     //活动属性map
     $mArag = new ActivityRelAttrGroup();
     $attrMap = $mArag->getAttrMapping($aid);
     if (!$one) {
         //入库
         $apdata = ['product_id' => $pid, 'acti_id' => $aid, 'user_id' => $user['uid'], 'status' => ActivityProduct::STATUS_SAVE, 'apply_way' => 0];
         $rel_id = $mactivitypdt->store($apdata);
         //插入到活动产品统计表
         $apstart = new ActivityProductStat();
         $data = ['rel_id' => $rel_id, 'acti_id' => $aid, 'product_id' => $pid];
         $apstart->store($data);
     } else {
         // //判断是否是官方申请
         // $model = $mactivitypdt->pk($one['id']);
         // $model->apply_way == 1 ? '' : $this->redirect(['home-page/lists', 'uid' => $user['uid']]);
         $rel_id = $one['id'];
         if ($one['apply_way'] == 1) {
             $apdata = ['id' => $rel_id, 'apply_way' => 0];
             $mactivitypdt->store($apdata);
         }
         if ($one['status'] == ActivityProduct::STATUS_VERIFYING) {
             //审核中
             return $this->redirect(['home-page/lists', 'uid' => $_SESSION['user']['uid']]);
             //跳转到完善信息
         } else {
             $ActivityProductAttrVal = new ActivityProductAttrVal();
             $attrval = $ActivityProductAttrVal->getRealAttrVals($rel_id, $aid);
             $attrval = array_merge($attrMap, $attrval);
             // echo '<pre>';
             // print_r($attrval);
             if (isset($attrval['album']['val']) && is_array($attrval['album']['val'])) {
                 foreach ($attrval['album']['val'] as $key => $value) {
                     if ($value['type'] == ProductImage::TYPE_CATIONFIRST) {
                         $fourpimag[] = $value;
                     }
                     if ($value['type'] == ProductImage::TYPE_CATIONINDE) {
                         $fivepimag[] = $value;
                     }
                 }
             }
         }
     }
     //查询左侧菜单
     $ActivityAttrGroup = new ActivityAttrGroup();
     $menu = $ActivityAttrGroup->getCompleteStatus($rel_id);
     //echo '<pre>';
     //print_r($attrval);
     // exit;
     $this->layout_data = 'uc';
     return $this->render('applybaiyingdiy', ['price' => $res[0]['price'], 'attrs' => isset($attrval) ? $attrval : '', 'pid' => $pid, 'rel_id' => $rel_id, 'menu' => $menu, 'attrMap' => $attrMap]);
 }
コード例 #5
0
 /**
  * 好产品详细页
  * @author song
  * @param int $rel_id 活动产品id
  *
  * @return
  * */
 public function actionDetail()
 {
     $rel_id = Yii::$app->request->get('rel_id');
     $rel_id = intval($rel_id);
     if ($rel_id > 0) {
         //查询活动产品详细
         $mActivityProduct = new ActivityProduct();
         $actproduct = $mActivityProduct->getDetailBypk($rel_id);
         if (!$actproduct && $actproduct['status'] != 3) {
             Yii::$app->util->msg('审核未通过,请联系管理员!');
             exit;
         }
         //查询活动产品属性
         $mapattrval = new ActivityProductAttrVal();
         $attrval = $mapattrval->getRealAttrVals($rel_id, ActivityBase::GOOD_PRODUCT);
         //投票信息
         $city = isset($attrval['division']['val']) ? $attrval['division']['val'] : '';
         $poll_type_id = PollType::GOODPRODUCT_TYPE;
         $mpoll = new poll();
         $pollone = $mpoll->getPollByCity($city, $poll_type_id);
         //投票项信息
         $moption = new polloption();
         $optione = $moption->getOptionByowner($pollone['poll_id'], $rel_id);
         //var_dump($optione);
         //exit;
         //增加页面访问量
         $ActivityProductStat_model = new ActivityProductStat();
         $ActivityProductStat_model->incr($rel_id, 'page_views');
         //产品类型
         $IProductType = new IProductType();
         $Ptype = $IProductType->product_type_list();
         $Ptype = ArrayHelper::map($Ptype, 'id', 'name');
         $Ptype[6] = "";
         //页面当name为『其他』时,不然显示
         // print_r($Ptype);exit;
         //            echo '<pre>';
         //            print_r($actproduct);
         // print_r($attrval);
         // exit;
         //数据过滤
         if (isset($attrval['pokedex']['val']) && is_array($attrval['pokedex']['val'])) {
             $tmp = [];
             foreach ($attrval['pokedex']['val'] as $v) {
                 if (!empty($v['title']) && !empty($v['desc']) && !empty($v['url'])) {
                     $tmp[] = $v;
                 }
             }
             $attrval['pokedex']['val'] = $tmp;
         }
         $this->layout = false;
         return $this->render('detail', ['attrval' => $attrval, 'product' => $actproduct, 'optione' => $optione, 'type' => $Ptype, 'goodproduct_city' => ActivityBase::GOODPRODUCT_CITY]);
     }
 }
コード例 #6
0
ファイル: BaiyingShare.php プロジェクト: songhongyu/idaiyan
 /**
  * 通过分享id 去的产品信息和价格属性,
  * @param int $sid  分享id
  *
  * @return array
  * */
 public function getSharebyid($sid)
 {
     $result = false;
     $sid = intval($sid);
     if ($sid) {
         $result = self::find()->where(['id' => $sid])->with(['product' => function ($query) {
             return $query->select(['id', 'name', 'type', 'title', 'album', 'user_oriented_age', 'user_oriented_gender', 'banner_image', 'price']);
         }])->asArray()->one();
         if ($result) {
             $mapattrval = new ActivityProductAttrVal();
             $acprattr = $mapattrval->getRealAttrVals($result['rel_id'], $result['acti_id']);
             $result['attr'] = $acprattr;
         }
     }
     return $result;
 }
コード例 #7
0
ファイル: DemoController.php プロジェクト: songhongyu/idaiyan
 public function actionApav()
 {
     $model = new ActivityProductAttrVal();
     $data = array('rel_id' => 101, 'acti_id' => 1, 'product_id' => 2000, 'attr_id' => 1, 'attr_val' => '你好吗');
     //var_dump($model->store($data));
     // var_dump($model->setStatus(1, ActivityAttrBase::STATUS_DISABLE));
     var_dump($model->getRealAttrVals(28843, 7));
 }
コード例 #8
0
 /**
  * Action ChooseActivity
  *
  */
 public function actionChooseActivity()
 {
     $user = yii::$app->util->isLogin();
     if (yii::$app->util->isAjax()) {
         $pid = Yii::$app->request->get('pid') ? Yii::$app->request->get('pid') : '';
         $rel_id = Yii::$app->request->get('rel_id') ? Yii::$app->request->get('rel_id') : '';
         if ($user) {
             if ($pid) {
                 $url = '/support/choose-activity?pid=' . $pid;
             } else {
                 $url = '/support/choose-activity?rel_id=' . $rel_id;
             }
             $data['url'] = $url;
             echo yii::$app->util->formatResEncode('0', '该用户已经登录', $data);
             exit;
         } else {
             echo yii::$app->util->formatResEncode('1', '该用户没有登录');
             exit;
         }
     }
     if (Yii::$app->request->get('pid') || Yii::$app->request->get('rel_id')) {
         $rel_id = Yii::$app->request->get('rel_id');
         if ($rel_id) {
             $mActivityProduct = new ActivityProduct();
             $productActivity = $mActivityProduct->getByIdAndStatus($rel_id);
             $pid = intval($productActivity['product_id']);
         } else {
             $pid = Yii::$app->request->get('pid');
         }
         $mProductBase = new IProductBase();
         $myproduct = $mProductBase->isMyProduct($user['uid'], $pid);
         // $myproduct = '';
         if (!$myproduct) {
             $mProductBase = new IProductBase();
             $mActivityBase = new ActivityBase();
             $mActivityProductAttrVal = new ActivityProductAttrVal();
             $result = $mProductBase->getAllById(intval($pid));
             //查询活动
             $activity = $mActivityBase->getByFeature();
             foreach ($activity as $key => $val) {
                 $key = $val['id'];
                 $activity[$key] = $val;
             }
             //var_dump($result['aproduct']);die;
             //产品对应活动和价格
             if (!empty($result['aproduct'])) {
                 foreach ($result['aproduct'] as $key => $value) {
                     $attr[] = $mActivityProductAttrVal->getRealAttrVals($value['id'], $value['acti_id']);
                     // echo "<pre>";
                     // var_dump($attr[$key]['discount_price']['val']['price']);die;
                     $result['aproduct'][$key]['attr'] = isset($attr[$key]['discount_price']['val']) ? $attr[$key]['discount_price']['val'] : 0;
                     $result['aproduct'][$key]['num'] = isset($attr[$key]['supply_num']['val']) ? $attr[$key]['supply_num']['val'] : 0;
                     $price[$value['id']] = isset($attr[$key]['discount_price']['val']['price']) ? $attr[$key]['discount_price']['val']['price'] : 0;
                     // $price[] = array($value['id'] => $attr[$key]['discount_price']['val']['price']);
                     // // $price[$value['id']] = $attr[$key]['discount_price']['val']['price'];
                     //var_dump($price);die;
                     if (!empty($activity[$value['acti_id']])) {
                         $result['aproduct'][$key]['activity'] = $activity[$value['acti_id']];
                     }
                 }
             } else {
                 return $this->redirect(['home-page/lists', 'uid' => $user['uid']]);
                 //跳转到完善信息
             }
             $productData = array('pid' => $pid, 'name' => $result['name'], 'summary' => $result['extra']['summary'], 'album' => $result['album'], 'price' => $result['price']);
             $session = Yii::$app->session;
             $session->isActive ? '' : $session->open();
             $session->set('product', $productData);
             if (isset($price)) {
                 $session->set('activityprice', $price);
             }
             //$session->set('activityprice',$price);
             // echo "<pre>";
             // //var_dump($productActivity['acti_id']);
             // var_dump($result);die;
             $this->layout = '@app/views/layouts/main.php';
             //调用个人中心的布局
             if ($result) {
                 return $this->render('chooseactivity', ['data' => isset($result) ? $result : '', 'acti_id' => isset($productActivity) ? $productActivity['acti_id'] : '']);
             }
         } else {
             return $this->redirect(['home-page/lists', 'uid' => $user['uid']]);
             //跳转到完善信息
         }
     } else {
         return $this->redirect('/product/index');
         //跳转到完善信息
     }
 }
コード例 #9
0
 public function actionBuysuccess()
 {
     $user = PublicLibrary::is_login();
     if ($user && $user['uid'] != 'weixin') {
         $uid = isset($user['uid']) ? $user['uid'] : '';
     } else {
         $this->redirect(['baiying/index']);
     }
     $parr = Yii::$app->request->get();
     //获取地址栏中get过来的信息
     // echo '<pre>';
     // print_r($parr);
     $orderno = strip_tags($parr['orderno']) ? strip_tags($parr['orderno']) : '';
     $model_order = new Order();
     $res = $model_order->Paysuccess($orderno);
     $this->layout = false;
     $rel_id = $res['rel_id'];
     $acti_id = $res['acti_id'];
     $mactpro = new ActivityProduct();
     $productattr = $mactpro->getDetailBypk($rel_id);
     $mapattrval = new ActivityProductAttrVal();
     $acprattr = $mapattrval->getRealAttrVals($rel_id, $acti_id);
     return $this->render('buysuccess', ['acprattr' => $acprattr, 'productattr' => $productattr]);
 }
コード例 #10
0
 /**
  * @author song
  * 提屁股 成功修改状态接口
  * @param int  $supportid 支持人id
  * @param int $supnum 踢屁股次数
  *
  * @return json
  * */
 public function actionGamesuccess()
 {
     //判断登陆
     $user = PublicLibrary::is_login();
     if ($user && $user['uid'] != 'weixin' && PublicLibrary::is_ajax()) {
         $date = Yii::$app->request->post();
         $supportid = isset($date['supportid']) ? intval($date['supportid']) : 0;
         $supnum = isset($date['supnum']) ? intval($date['supnum']) : 0;
         $msupport = new BaiyingSupport();
         $supportone = $msupport->pk($supportid);
         if ($supportone && $supportone['support_status'] == BaiyingSupport::SUPPORT_STATUS_DEF) {
             if ($supnum > BaiyingSupport::SUPPORT_STATAR) {
                 $mshare = new BaiyingShare();
                 //查询分享人uid
                 $oldres = $mshare->pk($supportone['shareid']);
                 $rel_id = $oldres['rel_id'];
                 //判断活动状态
                 $mactpro = new ActivityProduct();
                 $productattr = $mactpro->getDetailBypk($rel_id);
                 if ($productattr['status'] != ActivityProduct::STATUS_VERIFY_THROUGH) {
                     echo "<script>alert('活动已结束!'),window.location.href='/baiying/userproduct';</script>";
                     exit;
                 }
                 //查询该分享人所有的分享列表
                 $sharelist = $mshare->getSharelistByuid('', $oldres['uid'], ActivityBase::APPLY_BAIYING);
                 foreach ($sharelist as $key => $val) {
                     $sarr[] = $val['id'];
                 }
                 //查询当前用户支持成功的 记录
                 $usersuplist = $msupport->getSupportlist('', $user['uid'], BaiyingSupport::SUPPORT_STATUS_SUCCE);
                 foreach ($usersuplist as $key => $val) {
                     $uresanduser = $mshare->pk($val['shareid']);
                     //当前用户支持的产品的发布用户 等于 要支持订单的发布者
                     if ($uresanduser['uid'] == $oldres['uid']) {
                         $uarr[] = $val['shareid'];
                     }
                 }
                 if (isset($sarr) && isset($uarr)) {
                     $insec = array_intersect($sarr, $uarr);
                 }
                 //                $cc = isset($insec)?$insec:'1';
                 //                echo '<pre>';
                 //                print_r($cc);
                 if (isset($insec) && is_array($insec)) {
                 } else {
                     //增加分享支持统计数
                     $shafu = $mshare->addSharenum($supportone['shareid']);
                 }
                 $shareone = $mshare->pk($supportone['shareid']);
                 //支持数大于标准(30),且状态为1 修改支付状态
                 if ($shareone['share_num'] >= BaiyingShare::SHARE_STANDARD && $shareone['share_status'] == BaiyingShare::SHARE_STATUS_DEF) {
                     $sharecontent['id'] = $supportone['shareid'];
                     //商品剩余不足 状态修改成 售罄
                     //支付成功的分享
                     $succnum = $mshare->getcountnum($shareone['rel_id'], BaiyingShare::SHARE_STATUS_PAY);
                     //商品属性
                     $mapattrval = new ActivityProductAttrVal();
                     $acprattr = $mapattrval->getRealAttrVals($shareone['rel_id'], ActivityBase::APPLY_BAIYING);
                     if ($succnum >= $acprattr['supply_num']['attr_val']) {
                         $sharecontent['share_status'] = BaiyingShare::SHARE_OUT;
                     } else {
                         $sharecontent['share_status'] = BaiyingShare::SHARE_STATUS_SUCCE;
                     }
                     $res = $mshare->store($sharecontent);
                 }
                 $upcontent['support_status'] = BaiyingSupport::SUPPORT_STATUS_SUCCE;
             }
             //更新支持提屁股次数和 状态
             $upcontent['id'] = $supportid;
             $upcontent['uid'] = isset($user['uid']) ? $user['uid'] : '';
             $upcontent['mobile'] = isset($user['mobile']) ? $user['mobile'] : '';
             if ($supnum > $supportone['sup_num']) {
                 $upcontent['sup_num'] = $supnum;
             }
             $supfu = $msupport->store($upcontent);
             if ($supfu) {
                 echo PublicLibrary::format_res_encode('0', 'success', 'f**k');
             } else {
                 echo PublicLibrary::format_res_encode('1001', 'save error!');
             }
         } else {
             $upcontent['id'] = $supportid;
             if ($supnum > $supportone['sup_num']) {
                 $upcontent['sup_num'] = $supnum;
             }
             $upcontent['support_status'] = BaiyingSupport::SUPPORT_STATUS_SUCCE;
             $supfu = $msupport->store($upcontent);
             if ($supfu) {
                 echo PublicLibrary::format_res_encode('01', 'supnum up success!');
             } else {
                 echo PublicLibrary::format_res_encode('1003', 'supnum up error!');
             }
         }
     } else {
         echo PublicLibrary::format_res_encode('1001', 'the user no login or no ajax!');
         exit;
     }
 }
コード例 #11
0
 /**
  * 运营后台 设置365活动中 产品开始日期
  *
  *
  * */
 public function actionSetproductdate()
 {
     $user = PublicLibrary::is_login();
     if (isset($user['uid'])) {
         $uid = $user['uid'];
     } else {
         return $this->redirect(['product/index']);
         exit;
     }
     $form = Yii::$app->request->get();
     $form = array_map('trim', $form);
     $form = array_map('strip_tags', $form);
     $form = array_map('htmlspecialchars', $form);
     $page = isset($form['page']) ? intval($form['page']) : 1;
     $data['product_name'] = isset($form['product_name']) ? $form['product_name'] : '';
     $data['username'] = isset($form['username']) ? $form['username'] : '';
     $data['mobile'] = isset($form['mobile']) ? $form['mobile'] : '';
     $data['status'] = isset($form['status']) ? $form['status'] : '';
     $data['start_time'] = isset($form['start_time']) ? strtotime($form['start_time']) : '';
     $mactpro = new ActivityProduct();
     $date = $mactpro->get365Listpage($page, false, 3, $data);
     $pages = new Pagination(['totalCount' => $date->count(), 'pageSize' => 3]);
     //        echo '<pre>';
     //        var_dump($pages);
     $productlist = $date->asArray()->all();
     $mapattrval = new ActivityProductAttrVal();
     if ($productlist) {
         foreach ($productlist as $pl => $st) {
             $acprattr = $mapattrval->getRealAttrVals($st['id'], ActivityBase::GENERAL_ACTIVITY);
             $productlist[$pl]['attr'] = $acprattr;
         }
     }
     //        echo '<pre>';
     //        print_r($productlist);
     //        exit;
     $this->layout = false;
     return $this->render('setproductdate', ['productlist' => $productlist, 'data' => $data, 'pages' => $pages]);
 }