Coupon.php 69.3 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914
<?php

use Action\HuodongAction;
use Plugin\Helpers;
use LibModels\Wap\Cuxiao\ActivityData;
use Api\Yohobuy;

/**
 * 领券活动
 * 
 * @name Coupon
 * @package Cuxiao
 * @copyright yoho.inc
 * @version 1.0 (2015-11-25 13:08:58)
 * @author fei.hong <fei.hong@yoho.cn>
 */
class CouponController extends HuodongAction
{
    /* 用户会话ID */

    const SESSION_UID = 'coupon_uid';

    /**
     * 男生的品牌领券
     */
    public function boysbrandAction()
    {
        // 判断是否是应用访问, 拼接APP需要的URL参数
        $isApp = null !== $this->get('app_version');
        $isAppLogged = true;
        if ($isApp) {
            $isLogged = $this->get('uid') !== null;
            $isAppLogged = $this->checkIsLogin();
        } else {
            $isLogged = $this->getUid();
        }

        $urlBoys = Helpers::url('/cuxiao/coupon/boysbrand');
        $urlGirls = Helpers::url('/cuxiao/coupon/girlsbrand');
        $urlKids = Helpers::url('/cuxiao/coupon/kidsbrand');
        $urlLifestyle = Helpers::url('/cuxiao/coupon/lifestylebrand');
        $urlShare = Yohobuy::SERVICE_URL . '/operations/api/v5/webshare/getShare';
        $urlEncode = strtr($urlBoys, array('/' => '\\/'));

        $this->_view->display('boysbrand', array(
            'activityId' => 364, // 活动ID
            'staticTitle' => 'Yoho!Buy有货2015感恩季,1000万元+品牌专属优惠券大派送!', // 标题
            'isLogged' => $isLogged ? 'Y' : 'N', // 标识是否登录
            'jumpUrl' => $isAppLogged ? 'javascript:;' : $urlBoys . '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' . $urlEncode . '","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}',
            'weixinShare' => $isApp ? false : true, // 是否需要微信分享
            'shareLink' => $urlBoys,
            'shareTitle' => 'Yoho!Buy有货2015感恩季,1000万元+品牌专属优惠券大派送!',
            'shareImg' => 'http://img12.static.yhbimg.com/couponImg/2015/11/26/09/0226ad7f8bcf5467a789e17b761c7557e0.jpg',
            'shareDesc' => '2015感恩季!品牌专属优惠券限时送!先领券,再购物,让你乐享整个冬季!',
            'url_boys' => $urlBoys . '?yohobuy={"action":"go.h5","params":{"id":"364","share":"' . $urlShare . '","shareparam":{"share_id":"406"},"islogin":"N","type":0,"url":"' . $urlBoys . '","param":{}}}',
            'url_girls' => $urlGirls . '?yohobuy={"action":"go.h5","params":{"id":"366","share":"' . $urlShare . '","shareparam":{"share_id":"408"},"islogin":"N","type":0,"url":"' . $urlGirls . '","param":{}}}',
            'url_kids' => $urlKids . '?yohobuy={"action":"go.h5","params":{"id":"368","share":"' . $urlShare . '","shareparam":{"share_id":"410"},"islogin":"N","type":0,"url":"' . $urlKids . '","param":{}}}',
            'url_lifestyle' => $urlLifestyle . '?yohobuy={"action":"go.h5","params":{"id":"370","share":"' . $urlShare . '","shareparam":{"share_id":"412"},"islogin":"N","type":0,"url":"' . $urlLifestyle . '","param":{}}}',
            'url_350' => 'http://list.m.yohobuy.com/?gender=1,3&brand=350&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"350","title":"MACROPUS"}}',
            'url_160' => 'http://list.m.yohobuy.com/?gender=1,3&brand=60&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"60","title":"izzue"}}',
            'url_341' => 'http://list.m.yohobuy.com/?gender=1,3&brand=341&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"341","title":"鬼洗"}}',
            'url_710' => 'http://list.m.yohobuy.com/?gender=1,3&brand=710&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"710","title":"MADNESS"}}',
            'url_471' => 'http://list.m.yohobuy.com/?gender=1,3&brand=471&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"471","title":"DUSTY"}}',
            'url_495' => 'http://list.m.yohobuy.com/?gender=1,3&brand=495&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"495","title":"Lightning Bear"}}',
            'url_235' => 'http://list.m.yohobuy.com/?gender=1,3&brand=235&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"235","title":"Creamsoda"}}',
            'url_583' => 'http://list.m.yohobuy.com/?gender=1,3&brand=583&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"583","title":"Master Plan"}}',
            'url_402' => 'http://list.m.yohobuy.com/?gender=1,3&brand=402&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"402","title":"PROTEST博特斯"}}',
            'url_720' => 'http://list.m.yohobuy.com/?gender=1,3&brand=720&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"720","title":"NBA STYLE"}}',
            'url_138' => 'http://list.m.yohobuy.com/?gender=1,3&brand=138&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"138","title":"THETHING"}}',
            'url_506' => 'http://list.m.yohobuy.com/?gender=1,3&brand=506&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"506","title":"FUN"}}',
            'url_419' => 'http://list.m.yohobuy.com/?gender=1,3&brand=419&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"419","title":"HASO"}}',
            'url_581' => 'http://list.m.yohobuy.com/?gender=1,3&brand=581&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"581","title":"S.ANGELO"}}',
            'url_722' => 'http://list.m.yohobuy.com/?gender=1,3&brand=722&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"722","title":"FAIRWHALE JEANS"}}',
            'url_191' => 'http://list.m.yohobuy.com/?gender=1,3&brand=191&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"191","title":"Holymoly"}}',
            'url_417' => 'http://list.m.yohobuy.com/?gender=1,3&brand=417&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"417","title":"DEPOT3"}}',
            'url_672' => 'http://list.m.yohobuy.com/?gender=1,3&brand=672&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"672","title":"Shapeless"}}',
            'url_589' => 'http://list.m.yohobuy.com/?gender=1,3&brand=589&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"589","title":"One Republic"}}',
            'url_707' => 'http://list.m.yohobuy.com/?gender=1,3&brand=707&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"707","title":"Black Scale"}}',
            'url_550' => 'http://list.m.yohobuy.com/?gender=1,3&brand=550&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"550","title":"SYS.tag"}}',
            'url_600' => 'http://list.m.yohobuy.com/?gender=1,3&brand=600&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"600","title":"HAPPYATOMIC"}}',
            'url_152' => 'http://list.m.yohobuy.com/?gender=1,3&brand=52&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"52","title":"HEART"}}',
            'url_464' => 'http://list.m.yohobuy.com/?gender=1,3&brand=464&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"464","title":"Storm Stamps"}}',
            'url_102' => 'http://list.m.yohobuy.com/?gender=1,3&brand=1021&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"1021","title":"GAS"}}',
            'url_851' => 'http://list.m.yohobuy.com/?gender=1,3&brand=851&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"851","title":"Reshake"}}',
            'url_699' => 'http://list.m.yohobuy.com/?gender=1,3&brand=699&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"699","title":"DGK"}}',
            'url_103' => 'http://list.m.yohobuy.com/?gender=1,3&brand=1023&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"1023","title":"AGAMEMNON"}}',
            'url_114' => 'http://list.m.yohobuy.com/?gender=1,3&brand=114&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"114","title":"5CM"}}',
            'url_847' => 'http://list.m.yohobuy.com/?gender=1,3&brand=847&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"847","title":"Clarks ORIGINALS"}}',
            'url_536' => 'http://list.m.yohobuy.com/?gender=1,3&brand=536&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"536","title":"ABLE JEANS"}}',
            'url_230' => 'http://list.m.yohobuy.com/?gender=1,3&brand=230&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"230","title":"Dickies"}}',
            'url_343' => 'http://list.m.yohobuy.com/?gender=1,3&brand=343&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"343","title":"DC"}}',
            'url_692' => 'http://list.m.yohobuy.com/?gender=1,3&brand=692&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"692","title":"TRENDIANO"}}',
            'url_870' => 'http://list.m.yohobuy.com/?gender=1,3&brand=870&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"870","title":"浮士绘"}}',
            'url_444' => 'http://list.m.yohobuy.com/?gender=1,3&brand=444&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"444","title":"Evildoer"}}',
            'url_676' => 'http://list.m.yohobuy.com/?gender=1,3&brand=676&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"676","title":"Filter017"}}',
            'url_308' => 'http://list.m.yohobuy.com/?gender=1,3&brand=308&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"308","title":"SOLO"}}',
            'url_199' => 'http://list.m.yohobuy.com/?gender=1,3&brand=199&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"199","title":"ZERONE"}}',
            'url_714' => 'http://list.m.yohobuy.com/?gender=1,3&brand=714&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"714","title":"threeSociety"}}',
            'url_553' => 'http://list.m.yohobuy.com/?gender=1,3&brand=553&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"553","title":"DUNKELVOLK"}}',
            'url_194' => 'http://list.m.yohobuy.com/?gender=1,3&brand=194&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"194","title":"New Era"}}',
            'url_462' => 'http://list.m.yohobuy.com/?gender=1,3&brand=462&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"462","title":"SPRAYGROUND"}}',
            'url_136' => 'http://list.m.yohobuy.com/?gender=1,3&brand=136&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"136","title":"EASTPAK"}}',
            'url_641' => 'http://list.m.yohobuy.com/?gender=1,3&brand=641&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"641","title":"inmix"}}',
            'url_832' => 'http://list.m.yohobuy.com/?gender=1,3&brand=832&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"832","title":"CHUMS"}}',
            'url_940' => 'http://list.m.yohobuy.com/?gender=1,3&brand=940&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"940","title":"Trenta"}}',
            'url_719' => 'http://list.m.yohobuy.com/?gender=1,3&brand=719&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"719","title":"Rollie"}}',
        ));
    }

    /**
     * 女生的品牌领券
     * 
     * 上线时间 2015/12/1
     */
    public function girlsbrandAction()
    {
        // 判断是否是应用访问, 拼接APP需要的URL参数
        $isApp = null !== $this->get('app_version');
        $isAppLogged = true;
        if ($isApp) {
            $isLogged = $this->get('uid') !== null;
            $isAppLogged = $this->checkIsLogin();
        } else {
            $isLogged = $this->getUid();
        }

        $urlBoys = Helpers::url('/cuxiao/coupon/boysbrand');
        $urlGirls = Helpers::url('/cuxiao/coupon/girlsbrand');
        $urlKids = Helpers::url('/cuxiao/coupon/kidsbrand');
        $urlLifestyle = Helpers::url('/cuxiao/coupon/lifestylebrand');
        $urlShare = Yohobuy::SERVICE_URL . '/operations/api/v5/webshare/getShare';
        $urlEncode = strtr($urlGirls, array('/' => '\\/'));

        $this->_view->display('girlsbrand', array(
            'activityId' => 366, // 活动ID
            'staticTitle' => 'Yoho!Buy有货2015感恩季,1000万元+品牌专属优惠券大派送!', // 标题
            'jumpUrl' => $isAppLogged ? 'javascript:;' : $urlGirls . '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' . $urlEncode . '","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}',
            'isLogged' => $isLogged ? 'Y' : 'N', // 标识是否登录
            'weixinShare' => $isApp ? false : true, // 是否需要微信分享
            'shareLink' => $urlGirls,
            'shareTitle' => 'Yoho!Buy有货2015感恩季,1000万元+品牌专属优惠券大派送!',
            'shareImg' => 'http://img12.static.yhbimg.com/couponImg/2015/11/26/09/0226ad7f8bcf5467a789e17b761c7557e0.jpg',
            'shareDesc' => '2015感恩季!品牌专属优惠券限时送!先领券,再购物,让你乐享整个冬季!',
            'url_boys' => $urlBoys . '?yohobuy={"action":"go.h5","params":{"id":"364","share":"' . $urlShare . '","shareparam":{"share_id":"406"},"islogin":"N","type":0,"url":"' . $urlBoys . '","param":{}}}',
            'url_girls' => $urlGirls . '?yohobuy={"action":"go.h5","params":{"id":"366","share":"' . $urlShare . '","shareparam":{"share_id":"408"},"islogin":"N","type":0,"url":"' . $urlGirls . '","param":{}}}',
            'url_kids' => $urlKids . '?yohobuy={"action":"go.h5","params":{"id":"368","share":"' . $urlShare . '","shareparam":{"share_id":"410"},"islogin":"N","type":0,"url":"' . $urlKids . '","param":{}}}',
            'url_lifestyle' => $urlLifestyle . '?yohobuy={"action":"go.h5","params":{"id":"370","share":"' . $urlShare . '","shareparam":{"share_id":"412"},"islogin":"N","type":0,"url":"' . $urlLifestyle . '","param":{}}}',
            'url_570' => 'http://list.m.yohobuy.com/?gender=2,3&brand=570&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"570","title":"iyogurt"}}',
            'url_864' => 'http://list.m.yohobuy.com/?gender=2,3&brand=868&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"868","title":"Mango"}}',
            'url_824' => 'http://list.m.yohobuy.com/?gender=2,3&brand=824&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"824","title":"M.WOWL"}}',
            'url_536' => 'http://list.m.yohobuy.com/?gender=2,3&brand=536&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"536","title":"ABLEJEANS"}}',
            'url_257' => 'http://list.m.yohobuy.com/?gender=2,3&brand=257&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"257","title":"MYGESMART"}}',
            'url_342' => 'http://list.m.yohobuy.com/?gender=2,3&brand=342&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"342","title":":CHOCOOLATE"}}',
            'url_354' => 'http://list.m.yohobuy.com/?gender=2,3&brand=354&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"354","title":"CHEAPMONDAY"}}',
            'url_60' => 'http://list.m.yohobuy.com/?gender=2,3&brand=60&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"60","title":"izzue"}}',
            'url_324' => 'http://list.m.yohobuy.com/?gender=2,3&brand=324&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"324","title":"b+ab"}}',
            'url_589' => 'http://list.m.yohobuy.com/?gender=2,3&brand=589&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"589","title":"One Republic"}}',
            'url_191' => 'http://list.m.yohobuy.com/?gender=2,3&brand=191&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"191","title":"Holymoly"}}',
            'url_4' => 'http://list.m.yohobuy.com/?gender=2,3&brand=4&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"4","title":"5cm"}}',
            'url_768' => 'http://list.m.yohobuy.com/?gender=2,3&brand=768&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"768","title":"PH5"}}',
            'url_649' => 'http://list.m.yohobuy.com/?gender=2,3&brand=649&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"649","title":"Jeffrey Campbell"}}',
            'url_1026' => 'http://list.m.yohobuy.com/?gender=2,3&brand=1026&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"1026","title":"JNBY"}}',
            'url_1027' => 'http://list.m.yohobuy.com/?gender=2,3&brand=1027&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"1027","title":"less"}}',
            'url_481' => 'http://list.m.yohobuy.com/?gender=2,3&brand=481&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"481","title":"dresslab"}}',
            'url_450' => 'http://list.m.yohobuy.com/?gender=2,3&brand=450&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"450","title":"IntoTheRainbow"}}',
            'url_256' => 'http://list.m.yohobuy.com/?gender=2,3&brand=256&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"256","title":"BLACKJACK"}}',
            'url_701' => 'http://list.m.yohobuy.com/?gender=2,3&brand=701&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"701","title":"Bearburry"}}',
            'url_506' => 'http://list.m.yohobuy.com/?gender=2,3&brand=506&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"506","title":"FUN"}}',
            'url_569' => 'http://list.m.yohobuy.com/?gender=2,3&brand=569&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"569","title":"Aline de rose"}}',
            'url_981' => 'http://list.m.yohobuy.com/?gender=2,3&brand=981&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"981","title":"FUSIONCO"}}',
            'url_402' => 'http://list.m.yohobuy.com/?gender=2,3&brand=402&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"402","title":"PROTEST博特斯"}}',
            'url_1021' => 'http://list.m.yohobuy.com/?gender=2,3&brand=1021&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"1021","title":"GAS"}}',
            'url_860' => 'http://list.m.yohobuy.com/?gender=2,3&brand=860&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"860","title":"VING"}}',
            'url_435' => 'http://list.m.yohobuy.com/?gender=2,3&brand=435&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"435","title":"Dare To Dream"}}',
            'url_327' => 'http://list.m.yohobuy.com/?gender=2,3&brand=327&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"327","title":"Arubafootwear"}}',
            'url_505' => 'http://list.m.yohobuy.com/?gender=2,3&brand=505&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"505","title":"DEVIL NUT"}}',
            'url_987' => 'http://list.m.yohobuy.com/?gender=2,3&brand=987&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"987","title":"RIBERA"}}',
            'url_481' => 'http://list.m.yohobuy.com/?gender=2,3&brand=481&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"481","title":"dresslab"}}',
            'url_450' => 'http://list.m.yohobuy.com/?gender=2,3&brand=450&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"450","title":"IntoTheRainbow"}}',
            'url_256' => 'http://list.m.yohobuy.com/?gender=2,3&brand=256&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"256","title":"BLACKJACK"}}',
            'url_738' => 'http://list.m.yohobuy.com/?gender=2,3&brand=738&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"738","title":"Juni&Juli"}}',
            'url_947' => 'http://list.m.yohobuy.com/?gender=2,3&brand=947&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"947","title":"LONSDALE龙狮戴尔"}}',
            'url_760' => 'http://list.m.yohobuy.com/?gender=2,3&brand=760&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"760","title":"bread n butter"}}',
            'url_738' => 'http://list.m.yohobuy.com/?gender=2,3&brand=738&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"738","title":"Juni&Juli"}}',
            'url_778' => 'http://list.m.yohobuy.com/?gender=2,3&brand=778&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"778","title":"SLY"}}',
            'url_570' => 'http://list.m.yohobuy.com/?gender=2,3&brand=570&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"570","title":"iyogurt"}}',
            'url_868' => 'http://list.m.yohobuy.com/?gender=2,3&brand=868&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"868","title":"Mango"}}',
            'url_824' => 'http://list.m.yohobuy.com/?gender=2,3&brand=824&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"824","title":"M.WOWL"}}',
            'url_1031' => 'http://list.m.yohobuy.com/?gender=2,3&brand=1031&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"1031","title":"WHERE WHAT WHO 互然"}}',
            'url_734' => 'http://list.m.yohobuy.com/?gender=2,3&brand=734&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"734","title":"Dear栗"}}',
            'url_713' => 'http://list.m.yohobuy.com/?gender=2,3&brand=713&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"713","title":"D-mop"}}',
            'url_380' => 'http://list.m.yohobuy.com/?gender=2,3&brand=380&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"380","title":"supreme-lala"}}',
            'url_909' => 'http://list.m.yohobuy.com/?gender=2,3&brand=909&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"909","title":"清茶 Clear Tea"}}',
            'url_524' => 'http://list.m.yohobuy.com/?gender=2,3&brand=524&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"524","title":"I LOVE CHOC"}}',
            'url_968' => 'http://list.m.yohobuy.com/?gender=2,3&brand=968&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"968","title":"Activate water"}}',
            'url_517' => 'http://list.m.yohobuy.com/?gender=2,3&brand=517&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"517","title":"T.U.K"}}',
            'url_419' => 'http://list.m.yohobuy.com/?gender=2,3&brand=419&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"419","title":"HASO"}}',
            'url_1026' => 'http://list.m.yohobuy.com/?gender=2,3&brand=1026&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"1026","title":"JNBY"}}',
            'url_1027' => 'http://list.m.yohobuy.com/?gender=2,3&brand=1027&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"1027","title":"less"}}',
        ));
    }

    /**
     * 潮童的品牌领券
     * 
     * 上线时间 2015/12/1
     */
    public function kidsbrandAction()
    {
        // 判断是否是应用访问, 拼接APP需要的URL参数
        $isApp = null !== $this->get('app_version');
        $isAppLogged = true;
        if ($isApp) {
            $isLogged = $this->get('uid') !== null;
            $isAppLogged = $this->checkIsLogin();
        } else {
            $isLogged = $this->getUid();
        }
        $urlBoys = Helpers::url('/cuxiao/coupon/boysbrand');
        $urlGirls = Helpers::url('/cuxiao/coupon/girlsbrand');
        $urlKids = Helpers::url('/cuxiao/coupon/kidsbrand');
        $urlLifestyle = Helpers::url('/cuxiao/coupon/lifestylebrand');
        $urlShare = Yohobuy::SERVICE_URL . '/operations/api/v5/webshare/getShare';
        $urlEncode = strtr($urlKids, array('/' => '\\/'));

        $this->_view->display('kidsbrand', array(
            'activityId' => 368, // 活动ID
            'staticTitle' => 'Yoho!Buy有货2015感恩季,1000万元+品牌专属优惠券大派送!', // 标题
            'jumpUrl' => $isAppLogged ? 'javascript:;' : $urlKids . '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' . $urlEncode . '","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}',
            'isLogged' => $isLogged ? 'Y' : 'N', // 标识是否登录
            'weixinShare' => $isApp ? false : true, // 是否需要微信分享
            'shareLink' => $urlKids,
            'shareTitle' => 'Yoho!Buy有货2015感恩季,1000万元+品牌专属优惠券大派送!',
            'shareImg' => 'http://img12.static.yhbimg.com/couponImg/2015/11/26/09/0226ad7f8bcf5467a789e17b761c7557e0.jpg',
            'shareDesc' => '2015感恩季!品牌专属优惠券限时送!先领券,再购物,让你乐享整个冬季!',
            'url_boys' => $urlBoys . '?yohobuy={"action":"go.h5","params":{"id":"364","share":"' . $urlShare . '","shareparam":{"share_id":"406"},"islogin":"N","type":0,"url":"' . $urlBoys . '","param":{}}}',
            'url_girls' => $urlGirls . '?yohobuy={"action":"go.h5","params":{"id":"366","share":"' . $urlShare . '","shareparam":{"share_id":"408"},"islogin":"N","type":0,"url":"' . $urlGirls . '","param":{}}}',
            'url_kids' => $urlKids . '?yohobuy={"action":"go.h5","params":{"id":"368","share":"' . $urlShare . '","shareparam":{"share_id":"410"},"islogin":"N","type":0,"url":"' . $urlKids . '","param":{}}}',
            'url_lifestyle' => $urlLifestyle . '?yohobuy={"action":"go.h5","params":{"id":"370","share":"' . $urlShare . '","shareparam":{"share_id":"412"},"islogin":"N","type":0,"url":"' . $urlLifestyle . '","param":{}}}',
            'url_907' => 'http://list.m.yohobuy.com/?msort=365&brand=907&gender=1,2,3&openby:yohobuy={"action":"go.list","params":{"brand":"907","msort":"365","title":"AMES BROS"}}',
            'url_600' => 'http://list.m.yohobuy.com/?msort=365&brand=600&gender=1,2,3&openby:yohobuy={"action":"go.list","params":{"brand":"600","msort":"365","title":"HAPPYATOMIC"}}',
            'url_888' => 'http://list.m.yohobuy.com/?msort=365&brand=888&gender=1,2,3&openby:yohobuy={"action":"go.list","params":{"brand":"888","msort":"365","title":"Am&ot"}}',
            'url_855' => 'http://list.m.yohobuy.com/?msort=365&brand=855&gender=1,2,3&openby:yohobuy={"action":"go.list","params":{"brand":"855","msort":"365","title":"HOP"}}',
            'url_203' => 'http://list.m.yohobuy.com/?msort=365&brand=203&gender=1,2,3&openby:yohobuy={"action":"go.list","params":{"brand":"203","msort":"365","title":"Native"}}',
            'url_800' => 'http://list.m.yohobuy.com/?msort=365&brand=800&gender=1,2,3&openby:yohobuy={"action":"go.list","params":{"brand":"800","msort":"365","title":"MANAN"}}',
            'url_784' => 'http://list.m.yohobuy.com/?msort=365&brand=784&gender=1,2,3&openby:yohobuy={"action":"go.list","params":{"brand":"784","msort":"365","title":"香水娜娜"}}',
            'url_876' => 'http://list.m.yohobuy.com/?msort=365&brand=506&gender=1,2,3&openby:yohobuy={"action":"go.list","params":{"brand":"506","msort":"365","title":"Fun"}}',
        ));
    }

    /**
     * 创意生活的品牌领券
     * 
     * 上线时间 2015/12/1
     */
    public function lifestylebrandAction()
    {
        // 判断是否是应用访问, 拼接APP需要的URL参数
        $isApp = null !== $this->get('app_version');
        $isAppLogged = true;
        if ($isApp) {
            $isLogged = $this->get('uid') !== null;
            $isAppLogged = $this->checkIsLogin();
        } else {
            $isLogged = $this->getUid();
        }

        $urlBoys = Helpers::url('/cuxiao/coupon/boysbrand');
        $urlGirls = Helpers::url('/cuxiao/coupon/girlsbrand');
        $urlKids = Helpers::url('/cuxiao/coupon/kidsbrand');
        $urlLifestyle = Helpers::url('/cuxiao/coupon/lifestylebrand');
        $urlShare = Yohobuy::SERVICE_URL . '/operations/api/v5/webshare/getShare';
        $urlEncode = strtr($urlLifestyle, array('/' => '\\/'));

        $this->_view->display('lifestylebrand', array(
            'activityId' => 370, // 活动ID
            'staticTitle' => 'Yoho!Buy有货2015感恩季,1000万元+品牌专属优惠券大派送!', // 标题
            'jumpUrl' => $isAppLogged ? 'javascript:;' : $urlLifestyle . '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' . $urlEncode . '","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}',
            'isLogged' => $isLogged ? 'Y' : 'N', // 标识是否登录
            'weixinShare' => $isApp ? false : true, // 是否需要微信分享
            'shareLink' => $urlLifestyle,
            'shareTitle' => 'Yoho!Buy有货2015感恩季,1000万元+品牌专属优惠券大派送!',
            'shareImg' => 'http://img12.static.yhbimg.com/couponImg/2015/11/26/09/0226ad7f8bcf5467a789e17b761c7557e0.jpg',
            'shareDesc' => '2015感恩季!品牌专属优惠券限时送!先领券,再购物,让你乐享整个冬季!',
            'url_boys' => $urlBoys . '?yohobuy={"action":"go.h5","params":{"id":"364","share":"' . $urlShare . '","shareparam":{"share_id":"406"},"islogin":"N","type":0,"url":"' . $urlBoys . '","param":{}}}',
            'url_girls' => $urlGirls . '?yohobuy={"action":"go.h5","params":{"id":"366","share":"' . $urlShare . '","shareparam":{"share_id":"408"},"islogin":"N","type":0,"url":"' . $urlGirls . '","param":{}}}',
            'url_kids' => $urlKids . '?yohobuy={"action":"go.h5","params":{"id":"368","share":"' . $urlShare . '","shareparam":{"share_id":"410"},"islogin":"N","type":0,"url":"' . $urlKids . '","param":{}}}',
            'url_lifestyle' => $urlLifestyle . '?yohobuy={"action":"go.h5","params":{"id":"370","share":"' . $urlShare . '","shareparam":{"share_id":"412"},"islogin":"N","type":0,"url":"' . $urlLifestyle . '","param":{}}}',
            'url_166' => 'http://list.m.yohobuy.com/?msort=10&brand=166&gender=1,2,3&openby:yohobuy={"action":"go.list","params":{"brand":"166","msort":"10","title":"九口山"}}',
            'url_201' => 'http://list.m.yohobuy.com/?msort=10&brand=201&gender=1,2,3&openby:yohobuy={"action":"go.list","params":{"brand":"201","msort":"10","title":"wesc"}}',
            'url_626' => 'http://list.m.yohobuy.com/?msort=10&brand=626&gender=1,2,3&openby:yohobuy={"action":"go.list","params":{"brand":"626","msort":"10","title":"cliché"}}',
            'url_1024' => 'http://list.m.yohobuy.com/?msort=10&brand=1024&gender=1,2,3&openby:yohobuy={"action":"go.list","params":{"brand":"1024","msort":"10","title":"SANRIO"}}',
            'url_675' => 'http://list.m.yohobuy.com/?msort=10&brand=676&gender=1,2,3&openby:yohobuy={"action":"go.list","params":{"brand":"676","msort":"10","title":"Filter017"}}',
            'url_801' => 'http://list.m.yohobuy.com/?msort=10&brand=801&gender=1,2,3&openby:yohobuy={"action":"go.list","params":{"brand":"801","msort":"10","title":"Miss Moda"}}',
            'url_686' => 'http://list.m.yohobuy.com/?msort=10&brand=686&gender=1,2,3&openby:yohobuy={"action":"go.list","params":{"brand":"686","msort":"10","title":"H.DUE.O"}}',
            'url_501' => 'http://list.m.yohobuy.com/?msort=10&brand=501&gender=1,2,3&openby:yohobuy={"action":"go.list","params":{"brand":"501","msort":"10","title":"OFESS"}}',
            'url_925' => 'http://list.m.yohobuy.com/?msort=10&brand=925&gender=1,2,3&openby:yohobuy={"action":"go.list","params":{"brand":"925","msort":"10","title":"moshi 摩仕"}}',
            'url_932' => 'http://list.m.yohobuy.com/?msort=10&brand=932&gender=1,2,3&openby:yohobuy={"action":"go.list","params":{"brand":"932","msort":"10","title":"YESHM永衡"}}',
            'url_892' => 'http://list.m.yohobuy.com/?msort=10&brand=892&gender=1,2,3&openby:yohobuy={"action":"go.list","params":{"brand":"892","msort":"10","title":"I-MEGO"}}',
            'url_849' => 'http://list.m.yohobuy.com/?msort=10&brand=849&gender=1,2,3&openby:yohobuy={"action":"go.list","params":{"brand":"849","msort":"10","title":"ZEUSE"}}',
            'url_615' => 'http://list.m.yohobuy.com/?msort=10&brand=615&gender=1,2,3&openby:yohobuy={"action":"go.list","params":{"brand":"615","msort":"10","title":"PHILIPS"}}',
        ));
    }

    /**
     * 男生的品牌领券
     */
    public function boysbrand2Action()
    {
        // 判断是否是应用访问, 拼接APP需要的URL参数
        $isApp = null !== $this->get('app_version');
        $isAppLogged = true;
        if ($isApp) {
            $isLogged = $this->get('uid') !== null;
            $isAppLogged = $this->checkIsLogin();
        } else {
            $isLogged = $this->getUid();
        }

        $urlBoys = Helpers::url('/cuxiao/coupon/boysbrand2');
        $urlGirls = Helpers::url('/cuxiao/coupon/girlsbrand2');
        $urlKids = Helpers::url('/cuxiao/coupon/kidsbrand');
        $urlLifestyle = Helpers::url('/cuxiao/coupon/lifestylebrand');
        $urlShare = Yohobuy::SERVICE_URL . '/operations/api/v5/webshare/getShare';
        $urlEncode = strtr($urlBoys, array('/' => '\\/'));

        $this->_view->display('boysbrand-2', array(
            'activityId' => 372, // 活动ID
            'staticTitle' => 'Yoho!Buy有货2015感恩季,1000万元+品牌专属优惠券大派送!', // 标题
            'isLogged' => $isLogged ? 'Y' : 'N', // 标识是否登录
            'jumpUrl' => $isAppLogged ? 'javascript:;' : $urlBoys . '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' . $urlEncode . '","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}',
            'weixinShare' => $isApp ? false : true, // 是否需要微信分享
            'shareLink' => $urlBoys,
            'shareTitle' => 'Yoho!Buy有货2015感恩季,1000万元+品牌专属优惠券大派送!',
            'shareImg' => 'http://img12.static.yhbimg.com/couponImg/2015/11/26/09/0226ad7f8bcf5467a789e17b761c7557e0.jpg',
            'shareDesc' => '2015感恩季!品牌专属优惠券限时送!先领券,再购物,让你乐享整个冬季!',
            'url_boys' => $urlBoys . '?yohobuy={"action":"go.h5","params":{"id":"372","share":"' . $urlShare . '","shareparam":{"share_id":"406"},"islogin":"N","type":0,"url":"' . $urlBoys . '","param":{}}}',
            'url_girls' => $urlGirls . '?yohobuy={"action":"go.h5","params":{"id":"374","share":"' . $urlShare . '","shareparam":{"share_id":"408"},"islogin":"N","type":0,"url":"' . $urlGirls . '","param":{}}}',
            'url_kids' => $urlKids . '?yohobuy={"action":"go.h5","params":{"id":"368","share":"' . $urlShare . '","shareparam":{"share_id":"410"},"islogin":"N","type":0,"url":"' . $urlKids . '","param":{}}}',
            'url_lifestyle' => $urlLifestyle . '?yohobuy={"action":"go.h5","params":{"id":"370","share":"' . $urlShare . '","shareparam":{"share_id":"412"},"islogin":"N","type":0,"url":"' . $urlLifestyle . '","param":{}}}',
            'url_114' => 'http://list.m.yohobuy.com/?gender=1,3&brand=114&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"114","title":"5CM"}}',
            'url_847' => 'http://list.m.yohobuy.com/?gender=1,3&brand=847&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"847","title":"Clarks ORIGINALS"}}',
            'url_536' => 'http://list.m.yohobuy.com/?gender=1,3&brand=536&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"536","title":"ABLE JEANS"}}',
            'url_230' => 'http://list.m.yohobuy.com/?gender=1,3&brand=230&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"230","title":"Dickies"}}',
            'url_343' => 'http://list.m.yohobuy.com/?gender=1,3&brand=343&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"343","title":"DC"}}',
            'url_692' => 'http://list.m.yohobuy.com/?gender=1,3&brand=692&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"692","title":"TRENDIANO"}}',
            'url_870' => 'http://list.m.yohobuy.com/?gender=1,3&brand=870&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"870","title":"浮士绘"}}',
            'url_444' => 'http://list.m.yohobuy.com/?gender=1,3&brand=444&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"444","title":"Evildoer"}}',
            'url_676' => 'http://list.m.yohobuy.com/?gender=1,3&brand=676&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"676","title":"Filter017"}}',
            'url_308' => 'http://list.m.yohobuy.com/?gender=1,3&brand=308&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"308","title":"SOLO"}}',
            'url_199' => 'http://list.m.yohobuy.com/?gender=1,3&brand=199&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"199","title":"ZERONE"}}',
            'url_714' => 'http://list.m.yohobuy.com/?gender=1,3&brand=714&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"714","title":"threeSociety"}}',
            'url_553' => 'http://list.m.yohobuy.com/?gender=1,3&brand=553&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"553","title":"DUNKELVOLK"}}',
            'url_194' => 'http://list.m.yohobuy.com/?gender=1,3&brand=194&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"194","title":"New Era"}}',
            'url_462' => 'http://list.m.yohobuy.com/?gender=1,3&brand=462&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"462","title":"SPRAYGROUND"}}',
            'url_136' => 'http://list.m.yohobuy.com/?gender=1,3&brand=136&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"136","title":"EASTPAK"}}',
            'url_641' => 'http://list.m.yohobuy.com/?gender=1,3&brand=641&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"641","title":"inmix"}}',
            'url_832' => 'http://list.m.yohobuy.com/?gender=1,3&brand=832&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"832","title":"CHUMS"}}',
            'url_940' => 'http://list.m.yohobuy.com/?gender=1,3&brand=940&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"940","title":"Trenta"}}',
            'url_719' => 'http://list.m.yohobuy.com/?gender=1,3&brand=719&openby:yohobuy={"action":"go.list","params":{"gender":"1,3","brand":"719","title":"Rollie"}}',
        ));
    }

    /**
     * 女生的品牌领券
     * 
     * 上线时间 2015/12/7
     */
    public function girlsbrand2Action()
    {
        // 判断是否是应用访问, 拼接APP需要的URL参数
        $isApp = null !== $this->get('app_version');
        $isAppLogged = true;
        if ($isApp) {
            $isLogged = $this->get('uid') !== null;
            $isAppLogged = $this->checkIsLogin();
        } else {
            $isLogged = $this->getUid();
        }

        $urlBoys = Helpers::url('/cuxiao/coupon/boysbrand2');
        $urlGirls = Helpers::url('/cuxiao/coupon/girlsbrand2');
        $urlKids = Helpers::url('/cuxiao/coupon/kidsbrand');
        $urlLifestyle = Helpers::url('/cuxiao/coupon/lifestylebrand');
        $urlShare = Yohobuy::SERVICE_URL . '/operations/api/v5/webshare/getShare';
        $urlEncode = strtr($urlGirls, array('/' => '\\/'));

        $this->_view->display('girlsbrand-2', array(
            'activityId' => 374, // 活动ID
            'staticTitle' => 'Yoho!Buy有货2015感恩季,1000万元+品牌专属优惠券大派送!', // 标题
            'jumpUrl' => $isAppLogged ? 'javascript:;' : $urlGirls . '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' . $urlEncode . '","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}',
            'isLogged' => $isLogged ? 'Y' : 'N', // 标识是否登录
            'weixinShare' => $isApp ? false : true, // 是否需要微信分享
            'shareLink' => $urlGirls,
            'shareTitle' => 'Yoho!Buy有货2015感恩季,1000万元+品牌专属优惠券大派送!',
            'shareImg' => 'http://img12.static.yhbimg.com/couponImg/2015/11/26/09/0226ad7f8bcf5467a789e17b761c7557e0.jpg',
            'shareDesc' => '2015感恩季!品牌专属优惠券限时送!先领券,再购物,让你乐享整个冬季!',
            'url_boys' => $urlBoys . '?yohobuy={"action":"go.h5","params":{"id":"372","share":"' . $urlShare . '","shareparam":{"share_id":"406"},"islogin":"N","type":0,"url":"' . $urlBoys . '","param":{}}}',
            'url_girls' => $urlGirls . '?yohobuy={"action":"go.h5","params":{"id":"374","share":"' . $urlShare . '","shareparam":{"share_id":"408"},"islogin":"N","type":0,"url":"' . $urlGirls . '","param":{}}}',
            'url_kids' => $urlKids . '?yohobuy={"action":"go.h5","params":{"id":"368","share":"' . $urlShare . '","shareparam":{"share_id":"410"},"islogin":"N","type":0,"url":"' . $urlKids . '","param":{}}}',
            'url_lifestyle' => $urlLifestyle . '?yohobuy={"action":"go.h5","params":{"id":"370","share":"' . $urlShare . '","shareparam":{"share_id":"412"},"islogin":"N","type":0,"url":"' . $urlLifestyle . '","param":{}}}',
            'url_481' => 'http://list.m.yohobuy.com/?gender=2,3&brand=481&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"481","title":"dresslab"}}',
            'url_450' => 'http://list.m.yohobuy.com/?gender=2,3&brand=450&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"450","title":"IntoTheRainbow"}}',
            'url_256' => 'http://list.m.yohobuy.com/?gender=2,3&brand=256&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"256","title":"BLACKJACK"}}',
            'url_738' => 'http://list.m.yohobuy.com/?gender=2,3&brand=738&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"738","title":"Juni&Juli"}}',
            'url_947' => 'http://list.m.yohobuy.com/?gender=2,3&brand=947&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"947","title":"LONSDALE龙狮戴尔"}}',
            'url_760' => 'http://list.m.yohobuy.com/?gender=2,3&brand=760&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"760","title":"bread n butter"}}',
            'url_738' => 'http://list.m.yohobuy.com/?gender=2,3&brand=738&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"738","title":"Juni&Juli"}}',
            'url_778' => 'http://list.m.yohobuy.com/?gender=2,3&brand=778&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"778","title":"SLY"}}',
            'url_570' => 'http://list.m.yohobuy.com/?gender=2,3&brand=570&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"570","title":"iyogurt"}}',
            'url_868' => 'http://list.m.yohobuy.com/?gender=2,3&brand=868&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"868","title":"Mango"}}',
            'url_824' => 'http://list.m.yohobuy.com/?gender=2,3&brand=824&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"824","title":"M.WOWL"}}',
            'url_1031' => 'http://list.m.yohobuy.com/?gender=2,3&brand=1031&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"1031","title":"WHERE WHAT WHO 互然"}}',
            'url_734' => 'http://list.m.yohobuy.com/?gender=2,3&brand=734&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"734","title":"Dear栗"}}',
            'url_713' => 'http://list.m.yohobuy.com/?gender=2,3&brand=713&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"713","title":"D-mop"}}',
            'url_380' => 'http://list.m.yohobuy.com/?gender=2,3&brand=380&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"380","title":"supreme-lala"}}',
            'url_909' => 'http://list.m.yohobuy.com/?gender=2,3&brand=909&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"909","title":"清茶 Clear Tea"}}',
            'url_524' => 'http://list.m.yohobuy.com/?gender=2,3&brand=524&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"524","title":"I LOVE CHOC"}}',
            'url_968' => 'http://list.m.yohobuy.com/?gender=2,3&brand=968&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"968","title":"Activate water"}}',
            'url_517' => 'http://list.m.yohobuy.com/?gender=2,3&brand=517&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"517","title":"T.U.K"}}',
            'url_419' => 'http://list.m.yohobuy.com/?gender=2,3&brand=419&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"419","title":"HASO"}}',
            'url_1026' => 'http://list.m.yohobuy.com/?gender=2,3&brand=1026&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"1026","title":"JNBY"}}',
            'url_1027' => 'http://list.m.yohobuy.com/?gender=2,3&brand=1027&openby:yohobuy={"action":"go.list","params":{"gender":"2,3","brand":"1027","title":"less"}}',
        ));
    }

    /**
     * 新客领券 
     * 
     * 上线时间2015/12/2
     */
    public function newuserAction()
    {
        // 判断是否是应用访问, 拼接APP需要的URL参数
        $isApp = null !== $this->get('app_version');
        $isAppLogged = true;
        if ($isApp) {
            $isLogged = $this->get('uid') !== null;
            $isAppLogged = $this->checkIsLogin();
        } else {
            $isLogged = $this->getUid();
        }
        $urlNewuser = Helpers::url('/cuxiao/coupon/newuser');
        $urlYohope = Helpers::url('/cuxiao/coupon/yohope');
        $urlHelp = Helpers::url('/cuxiao/coupon/help');
        $urlMycoupon = Helpers::url('/home/coupons', null, 'default');
        $urlEncode = strtr($urlNewuser, array('/' => '\\/'));

        $this->_view->display('newuser', array(
            'activityId' => 418, // 活动ID
            'staticTitle' => '新人潮这看,超值惊喜等你领', // 标题
            'jumpUrl' => $isAppLogged ? 'javascript:;' : $urlNewuser . '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' . $urlEncode . '","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}',
            'isLogged' => $isLogged ? 'Y' : 'N', // 标识是否登录
            'url_mycoupon' => $urlMycoupon . '?openby:yohobuy={"action":"go.coupon"}',
            'url_yohope' => $urlYohope . '?yohobuy={"action":"go.h5","params":{"islogin":"Y","type":0,"url":"' . $urlYohope . '","param":{}}}',
            'url_help' => $urlHelp . '?yohobuy={"action":"go.h5","params":{"islogin":"Y","type":0,"url":"' . $urlHelp . '","param":{}}}',
            'url_more' => 'http://list.m.yohobuy.com/?msort=1&openby:yohobuy={"action":"go.list","params":{"msort":"1","title":"上衣"}}',
            'url_4' => 'http://5cm.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"4"}}',
            'url_343' => 'http://dc.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"343"}}',
            'url_230' => 'http://dickies.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"230"}}',
            'url_536' => 'http://ablejeans.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"536"}}',
            'url_847' => 'http://clarksoriginals.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"847"}}',
            'url_868' => 'http://mango.m.yohobuy.com/?gender=2,3&openby:yohobuy={"action":"go.brand","params":{"brand_id":"868"}}',
            'url_1026' => 'http://jnby.m.yohobuy.com/?gender=2,3&openby:yohobuy={"action":"go.brand","params":{"brand_id":"1026"}}',
            'url_570' => 'http://iyogurt.m.yohobuy.com/?gender=2,3&openby:yohobuy={"action":"go.brand","params":{"brand_id":"570"}}',
            'url_778' => 'http://sly.m.yohobuy.com/?gender=2,3&openby:yohobuy={"action":"go.brand","params":{"brand_id":"778"}}',
            'url_517' => 'http://tuk.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"517"}}',
        ));
    }

    /**
     * 新客领券(第二波)12月21号上线
     */
    public function newuser2Action()
    {
        // 判断是否是应用访问, 拼接APP需要的URL参数
        $isApp = null !== $this->get('app_version');
        $isAppLogged = true;
        if ($isApp) {
            $isLogged = $this->get('uid') !== null;
            $isAppLogged = $this->checkIsLogin();
        } else {
            $isLogged = $this->getUid();
        }
        $urlNewuser = Helpers::url('/cuxiao/coupon/newuser2');
        $urlYohope = Helpers::url('/cuxiao/coupon/yohope');
        $urlHelp = Helpers::url('/cuxiao/coupon/help');
        $urlMycoupon = Helpers::url('/home/coupons', null, 'default');
        $urlEncode = strtr($urlNewuser, array('/' => '\\/'));
        $channel = $this->get('yh_channel', '1');
        switch (strval($channel)) {
            case '1':
                $gender = '1,3';
                break;
            case '2':
                $gender = '2,3';
                break;
            default:
                $gender = '1,2,3';
        }
        $url = Helpers::url('/boys', array(), 'default') . '?openby:yohobuy={"action":"go.home","params":{"gender":"' . $gender . '","channel":"' . $channel . '"}}';

        $this->_view->display('newuser2', array(
            'activityId' => 444, // 87活动ID
            'staticTitle' => '新人潮这看,超值惊喜等你领', // 标题
            'jumpUrl' => $isAppLogged ? 'javascript:;' : $urlNewuser . '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' . $urlEncode . '","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}',
            'isLogged' => $isLogged ? 'Y' : 'N', // 标识是否登录
            'url_mycoupon' => $urlMycoupon . '?openby:yohobuy={"action":"go.coupon"}',
            'url_yohope' => $urlYohope . '?yohobuy={"action":"go.h5","params":{"islogin":"Y","type":0,"url":"' . $urlYohope . '","param":{}}}',
            'url_help' => $urlHelp . '?yohobuy={"action":"go.h5","params":{"islogin":"Y","type":0,"url":"' . $urlHelp . '","param":{}}}',
            'url_more' => $url,
            'url_4' => 'http://list.m.yohobuy.com/?msort=365&openby:yohobuy={"action":"go.list","params":{"msort":"365","title":"童装"}}',
            'url_343' => 'http://list.m.yohobuy.com/?msort=10&openby:yohobuy={"action":"go.list","params":{"misort":"10","title":"创意生活"}}',
            'url_230' => 'http://list.m.yohobuy.com/?msort=1&misort=18,20,21,22,226&openby:yohobuy={"action":"go.list","params":{"msort":"1","misort":"18,20,21,22,226","title":"冬装"}}',
            'url_536' => 'http://list.m.yohobuy.com/?msort=3&misort=26,27,345&openby:yohobuy={"action":"go.list","params":{"msort":"3","misort":"26,27,345","title":"裤装"}}',
            'url_847' => 'http://list.m.yohobuy.com/?msort=7,8&openby:yohobuy={"action":"go.list","params":{"msort":"7,8","title":"包配"}}',
            'url_900' => 'http://list.m.yohobuy.com/?msort=4&openby:yohobuy={"action":"go.list","params":{"msort":"4","title":"裙装"}}',
            'url_868' => 'http://list.m.yohobuy.com/?msort=1&misort=11,12,257,16&openby:yohobuy={"action":"go.list","params":{"msort":"1","misort":"11,12,257,16","title":"内搭"}}',
            'url_1026' => 'http://list.m.yohobuy.com/?msort=6&misort=45&openby:yohobuy={"action":"go.list","params":{"msort":"6","misort":"45","title":"冬靴"}}'
        ));
    }
    
      /**
     * 新客领券(第三波)2016年1月7号上线
     */
    public function newuser3Action()
    {
        // 判断是否是应用访问, 拼接APP需要的URL参数
        $isApp = null !== $this->get('app_version');
        $isAppLogged = true;
        if ($isApp) {
            $isLogged = $this->get('uid') !== null;
            $isAppLogged = $this->checkIsLogin();
        } else {
            $isLogged = $this->getUid();
        }
        $urlNewuser = Helpers::url('/cuxiao/coupon/newuser3');
        $urlYohope = Helpers::url('/cuxiao/coupon/yohope');
        $urlHelp = Helpers::url('/cuxiao/coupon/help');
        $urlMycoupon = Helpers::url('/home/coupons', null, 'default');
        $urlEncode = strtr($urlNewuser, array('/' => '\\/'));
        $channel = $this->get('yh_channel', '1');
        switch (strval($channel)) {
            case '1':
                $gender = '1,3';
                break;
            case '2':
                $gender = '2,3';
                break;
            default:
                $gender = '1,2,3';
        }
        $url = Helpers::url('/boys', array(), 'default') . '?openby:yohobuy={"action":"go.home","params":{"gender":"' . $gender . '","channel":"' . $channel . '"}}';

        $this->_view->display('newuser3', array(
            'activityId' => 472, // 94活动ID
            'staticTitle' => '新人潮这看,超值惊喜等你领', // 标题
            'jumpUrl' => $isAppLogged ? 'javascript:;' : $urlNewuser . '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' . $urlEncode . '","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}',
            'isLogged' => $isLogged ? 'Y' : 'N', // 标识是否登录
            'url_mycoupon' => $urlMycoupon . '?openby:yohobuy={"action":"go.coupon"}',
            'url_yohope' => $urlYohope . '?yohobuy={"action":"go.h5","params":{"islogin":"Y","type":0,"url":"' . $urlYohope . '","param":{}}}',
            'url_help' => $urlHelp . '?yohobuy={"action":"go.h5","params":{"islogin":"Y","type":0,"url":"' . $urlHelp . '","param":{}}}',
            'url_more' => $url,
            'url_1' => 'http://list.m.yohobuy.com/?msort=1&misort=18,20,21,22&title=冬装&openby:yohobuy={"action":"go.list","params":{"msort":"1","misort":"18,20,21,22","title":"冬装"}}',
            'url_2' => 'http://list.m.yohobuy.com/?msort=6&misort=45&title=靴子&openby:yohobuy={"action":"go.list","params":{"msort":"6","misort":"45","title":"靴子"}}',
            'url_3' => 'http://list.m.yohobuy.com/?msort=1&misort=16,257&title=春装&openby:yohobuy={"action":"go.list","params":{"msort":"1","misort":"16,257","title":"春装"}}',
            'url_4' => 'http://list.m.yohobuy.com/?msort=3,4&title=下装&openby:yohobuy={"action":"go.list","params":{"msort":"3,4","title":"下装"}}',
            'url_5' => 'http://list.m.yohobuy.com/?msort=7,8&title=包配&openby:yohobuy={"action":"go.list","params":{"msort":"7,8","title":"包配"}}',
            'url_6' => 'http://list.m.yohobuy.com/?msort=1,3,6&misort=11,28,12,46&title=反季&openby:yohobuy={"action":"go.list","params":{"msort":"1,3,6","misort":"11,28,12,46","title":"反季"}}',
        ));
    }

    /**
     * 新客领券YOHOPE
     * 
     * 上线时间2015/12/2
     */
    public function yohopeAction()
    {
        $this->_view->display('newuser-yohope', array(
            'staticTitle' => '新人潮这看,超值惊喜等你领', // 标题
            'url_208' => 'http://lal.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"208"}}',
            'url_256' => 'http://blackjack.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"256"}}',
            'url_257' => 'http://mygesmart.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"257"}}',
            'url_450' => 'http://intotherainbow.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"450"}}',
            'url_444' => 'http://evildoer.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"444"}}',
            'url_443' => 'http://preppyelite.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"443"}}',
            'url_261' => 'http://teebacco.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"261"}}',
            'url_350' => 'http://macropus.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"350"}}',
            'url_302' => 'http://ivyboi.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"302"}}',
            'url_852' => 'http://gawsfoot.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"852"}}',
            'url_570' => 'http://iyogurt.m.yohobuy.com/?gender=2,3&openby:yohobuy={"action":"go.brand","params":{"brand_id":"570"}}',
            'url_560' => 'http://gaws.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"560"}}',
            'url_520' => 'http://gawscap.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"520"}}',
            'url_562' => 'http://gawsdigi.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"562"}}',
            'url_672' => 'http://shapeless.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"672"}}',
            'url_678' => 'http://halfgirl.m.yohobuy.com/?gender=2,3&openby:yohobuy={"action":"go.brand","params":{"brand_id":"678"}}',
            'url_396' => 'http://eightguys.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"396"}}',
            'url_397' => 'http://pinealbody.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"397"}}',
            'url_550' => 'http://systag.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"550"}}',
            'url_591' => 'http://flyd.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"591"}}',
            'url_583' => 'http://masterplan.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"583"}}',
            'url_598' => 'http://dpk.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"598"}}',
            'url_824' => 'http://mwowl.m.yohobuy.com/?gender=2,3&openby:yohobuy={"action":"go.brand","params":{"brand_id":"824"}}',
            'url_481' => 'http://dresslab.m.yohobuy.com/?gender=2,3&openby:yohobuy={"action":"go.brand","params":{"brand_id":"481"}}',
            'url_701' => 'http://bearburry.m.yohobuy.com/?gender=2,3&openby:yohobuy={"action":"go.brand","params":{"brand_id":"701"}}',
            'url_464' => 'http://stormstamps.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"464"}}',
        ));
    }

    /**
     * 新客领券 - 如何使用优惠券帮助页 
     * 
     * 上线时间2015/12/2
     */
    public function helpAction()
    {
        $this->_view->display('newuser-help', array(
            'staticTitle' => '如何使用优惠券'
        ));
    }
    
    /**
     * Final Sale 领券活动
     * 
     * 上线时间2016/01/12
     */
    public function finalAction()
    {
        //获取登录者ID,未登录返回false
        $uid = $this->getLoggedUid();
        if (!$uid || !is_numeric($uid)) {
            //未登录的用户访问,跳转到登录页面。并且在登陆后跳转回本页面
            $this->go(Helpers::url('/signin.html', array('refer' => Helpers::url('/cuxiao/coupon/final')), 'default'));
        }
        
        // 该变量用来控制和显示页面的弹出提示
        $showPopupFlag = '0';

        //获取跳转到个人中心-我的优惠券链接,并调用接口,完成领券操作
        $myCouponUrl = Helpers::url('/home/coupons', null, 'default') . '?openby:yohobuy={"action":"go.coupon"}';
        $activityId = $this->getActivityId();
        $result = ActivityData::getCouponAll($uid, $activityId);
        if (isset($result['code'])) {
            switch (intval($result['code'])) {
                case 200: // 领取成功, 发送站内信消息
                    $showPopupFlag = '0';
                    $this->sendMessage($uid, '【优惠券】您获得350元套券', '尊敬的客户:恭喜您成功获得350元套券!您可以在个人中心查看优惠券信息。');
                    break;
                case 201: // 已领取过, 提示重复领券
                    $showPopupFlag = '1';
                    break;
                default: // 领取失败, 提示领券失败
                    $showPopupFlag = '2';
                    break;
            }
        }

        $this->_view->display('final', array(
            'staticTitle' => 'YOHO!BUY有货【Final Sale】',
            'weixinShare' => $this->_isApp ? false : true, // 是否需要微信分享
            'shareLink' => 'http://feature.yohobuy.com/0/0/767/index.html',
            'shareTitle' => 'YOHO!BUY有货【Final Sale】年终热促,重磅升级!全场3折起,折上最高直减¥1000!',
            'shareDesc' => '350元优惠券限时派送~购物满额即赠价值千元的有货限量猴年利是封!',
            'shareImg' => 'http://img11.static.yhbimg.com/couponImg/2016/01/07/07/016f63f5bb1f12cdb19402371323d26798.png',
            'showPopupFlag' => $showPopupFlag,
            'myCouponUrl' => $myCouponUrl,
            'bannerUrl_1' => 'http://feature.yoho.cn/0112/0112APPHOMEBOY/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"FINAL SALE重磅升级","url":"http://feature.yoho.cn/0112/0112APPHOMEBOY/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"536"},"param":{"share_id":"536"}}}',
            'bannerUrl_2' => 'http://feature.yoho.cn/0112/0112APPHOMEGIRL/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"FINAL SALE重磅升级","url":"http://feature.yoho.cn/0112/0112APPHOMEGIRL/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"534"},"param":{"share_id":"534"}}}',
            'bannerUrl_3' => 'http://feature.yoho.cn/0112/0112APPHOMEKIDS/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"FINAL SALE重磅升级","url":"http://feature.yoho.cn/0112/0112APPHOMEKIDS/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"532"},"param":{"share_id":"532"}}}',
            'bannerUrl_4' => 'http://feature.yoho.cn/0112/0112APPHOMELIFE/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"FINAL SALE重磅升级","url":"http://feature.yoho.cn/0112/0112APPHOMELIFE/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"530"},"param":{"share_id":"530"}}}',
            'downAppUrl' => 'http://www.yohoshow.com/about/index/yohobuyqr',
        ));
    }
    
    /**
     * Final Sale 领券活动第二波
     * 
     * 上线时间2016/01/25
     */
    public function final2Action()
    {
        //获取登录者ID,未登录返回false
        $uid = $this->getLoggedUid();
        if (!$uid || !is_numeric($uid)) {
            //未登录的用户访问,跳转到登录页面。并且在登陆后跳转回本页面
            $this->go(Helpers::url('/signin.html', array('refer' => Helpers::url('/cuxiao/coupon/final2')), 'default'));
        }
        
        // 该变量用来控制和显示页面的弹出提示
        $showPopupFlag = '0';

        //获取跳转到个人中心-我的优惠券链接,并调用接口,完成领券操作
        $myCouponUrl = Helpers::url('/home/coupons', null, 'default') . '?openby:yohobuy={"action":"go.coupon"}';
        $activityId = $this->getActivityId2();
        $result = ActivityData::getCouponAll($uid, $activityId);
        if (isset($result['code'])) {
            switch (intval($result['code'])) {
                case 200: // 领取成功, 发送站内信消息
                    $showPopupFlag = '0';
                    $this->sendMessage($uid, '【优惠券】您获得618元套券', '尊敬的客户:恭喜您成功获得618元套券!您可以在个人中心的交易管理中查看‘我的优惠券’。');
                    break;
                case 201: // 已领取过, 提示重复领券
                    $showPopupFlag = '1';
                    break;
                default: // 领取失败, 提示领券失败
                    $showPopupFlag = '2';
                    break;
            }
        }

        $this->_view->display('final-2', array(
            'staticTitle' => 'YOHO!BUY有货【Final Sale】年终热促',
            'weixinShare' => $this->_isApp ? false : true, // 是否需要微信分享
            'shareLink' => 'http://feature.yohobuy.com/0/0/775/index.html',
            'shareTitle' => 'YOHO!BUY有货【Final Sale】年终热促,新年特辑开启!全场2折起,折上最高直减¥1000!',
            'shareDesc' => '618元优惠券限时派送~购物满额即赠价值千元的有货限量猴年利是封!',
            'shareImg' => 'http://img11.static.yhbimg.com/couponImg/2016/01/07/07/016f63f5bb1f12cdb19402371323d26798.png',//@todo
            'showPopupFlag' => $showPopupFlag,
            'myCouponUrl' => $myCouponUrl,
            'bannerUrl_1' => 'http://feature.yoho.cn/0125/0125APPHOMEBOY/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"FINAL SALE","url":"http://feature.yoho.cn/0125/0125APPHOMEBOY/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"374"},"param":{"share_id":"374"}}}',
            'bannerUrl_2' => 'http://feature.yoho.cn/0125/0125APPHOMEGIRL/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"FINAL SALE","url":"http://feature.yoho.cn/0125/0125APPHOMEGIRL/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"372"},"param":{"share_id":"372"}}}',
            'bannerUrl_3' => 'http://feature.yoho.cn/0125/0125APPHOMEKIDS/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"FINAL SALE","url":"http://feature.yoho.cn/0125/0125APPHOMEKIDS/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"370"},"param":{"share_id":"370"}}}',
            'bannerUrl_4' => 'http://feature.yoho.cn/0125/0125APPHOMELIFE/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"FINAL SALE","url":"http://feature.yoho.cn/0125/0125APPHOMELIFE/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"368"},"param":{"share_id":"368"}}}',
            'downAppUrl' => 'http://www.yohoshow.com/about/index/yohobuyqr',
        ));
    }
          

    /**
     * 领取指定的优惠券
     * 
     * @param int activityId 活动ID
     * @param int couponId 优惠券ID
     * @return json
     */
    public function getnamedAction()
    {
        $result = array('code' => 401, 'message' => '领取失败', 'data' => '');

        do {
            /* 判断是不是AJAX请求 */
            if (!$this->isAjax()) {
                break;
            }

            /* 判断参数是否有效 */
            $activityId = $this->post('activityId');
            $couponId = $this->post('couponId');
            if (!is_numeric($activityId) || !is_numeric($couponId)) {
                break;
            }

            /* 判断用户是否登录 */
            $uid = $this->getSession(self::SESSION_UID);
            if (!$uid) {
                $uid = $this->getUid();
                if (!$uid) {
                    $result['code'] = 400;
                    $result['message'] = '请先登录';
                    $result['data'] = Helpers::url('/signin.html', array('refer' => $this->server('HTTP_REFERER', '/')), 'default');
                    break;
                }
            }

            /* 领取指定的优惠券操作 */
            $result = ActivityData::getCouponNamed($uid, $activityId, $couponId);
        } while (false);

        $this->echoJson($result);
    }

    /**
     * 领取所有的优惠券
     * 
     * @param int activityId 活动ID
     * @return json
     */
    public function getallAction()
    {
        $result = array('code' => 401, 'message' => '领取失败', 'data' => '');

        do {
            /* 判断是不是AJAX请求 */
            if (!$this->isAjax()) {
                break;
            }

            /* 判断参数是否有效 */
            $activityId = $this->post('activityId');
            if (!is_numeric($activityId)) {
                break;
            }

            /* 判断用户是否登录 */
            $uid = $this->getUid();
            if (!$uid) {
                $uid = $this->getSession(self::SESSION_UID);
                if (!$uid) {
                    $result['code'] = 400;
                    $result['message'] = '请先登录';
                    $result['data'] = Helpers::url('/signin.html', array('refer' => $this->server('HTTP_REFERER', '/')), 'default');
                    break;
                }
            }

            /* 领取指定的优惠券操作 */
            $result = ActivityData::getCouponAll($uid, $activityId);
        } while (false);

        $this->echoJson($result);
    }

    /**
     * 检查用户是否登录
     * 
     * @return bool (false:表示未登录,true:表示已登录)
     */
    private function checkIsLogin()
    {
        do {
            /* 判断是否有参数 */
            $uid = $this->get('uid');
            if (empty($uid) || !is_numeric($uid)) {
                break;
            }

            /* 判断参数是否有效 */
            $secret = $this->get('client_secret');
            if (!isset($secret)) {
                break;
            }

            $this->setSession(self::SESSION_UID, $uid);

            return true;
        } while (false);

        return false;
    }
    
        /**
     * 检测登录状态
     * 
     * @return int
     */
    private function getLoggedUid()
    {
        // 判断是否是应用访问, 拼接APP需要的URL参数
        $this->_isApp = (null !== $this->get('app_version') || null !== $this->get('uid'));
        $uid = false;
        if ($this->_isApp) {
            $uid = $this->get('uid');
        } else {
            $uid = $this->getUid();
        }

        return $uid;
    }

    /**
     * 发送站内信
     * 
     * @param int $uid 用户ID
     */
    private function sendMessage($uid, $title, $content)
    {
        try {
            ActivityData::message($uid, $title, $content);
        } catch (Exception $e) {
            // do nothing
        }
    }

    /**
     * 根据环境来获取活动ID
     * 
     * @return int
     */
    private function getActivityId()
    {
        // 设置环境变量
        switch (APPLICATION_ENV) {
            case 'production': // 生产
                return 466;
            case 'preview':      // 预览
            case 'testing':      // 测试
            case 'develop':      // 开发
            default:
                return 89;
        }
    }
    
    /**
     * 根据环境来获取活动ID
     * 
     * @return int
     */
    private function getActivityId2()
    {
        // 设置环境变量
        switch (APPLICATION_ENV) {
            case 'production': // 生产
                return 468;
            case 'preview':      // 预览
                return 468;
            case 'testing':      // 测试
            case 'develop':      // 开发
            default:
                return 483;
        }
    }

}