Index.php 46.1 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 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130
<?php

namespace app\api\controller;

use app\common\controller\Api;
use think\Db;

/**
 * 首页接口
 */
class Index extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];


    /**
     * 首页接口
     * @ApiTitle    (用户端首页)
     * @ApiSummary  (用户端首页)
     * @ApiMethod   (POST)
     * @ApiRoute    (/api/Index/UserIndex)
     * @ApiParams   (name="lng", type="integer", required=true, description="经度")
     * @ApiParams   (name="lat", type="integer", required=true, description="维度")
     * @ApiParams   (name="city", type="string", required=true, description="省市区/天津市天津市西青区")
     * @ApiParams   (name="keywords", type="string", required=true, description="搜索/空=''")
     * @ApiParams   (name="pages", type="integer", required=true, description="pages")
     * @ApiParams   (name="rows", type="integer", required=true, description="rows")
     * @ApiReturnParams   (name="code", type="integer", required=true, sample="0")
     * @ApiReturnParams   (name="msg", type="string", required=true, sample="返回成功")
     * @ApiReturn   ({
    'code':'1',
    'msg':'返回成功',
    "data": {
    "IndexBanner": [ //首页轮播图
    {
    "id": 3, //ID
    "image": "http://www.obituaries.com/uploads/20201208/eaea75b1acab02914d319e7ba932f5ce.png", //图片
    "web": "https://www.baidu.com" //外链
    },
    {
    "id": 2,
    "image": "http://www.obituaries.com/uploads/20201208/eaea75b1acab02914d319e7ba932f5ce.png",
    "web": "https://www.baidu.com"
    },
    {
    "id": 1,
    "image": "http://www.obituaries.com/uploads/20201208/eaea75b1acab02914d319e7ba932f5ce.png",
    "web": "https://www.baidu.com"
    }
    ],
    "Count": 3, //数据总数
    "List": [
    {
    "id": 1,  //店铺ID
    "Image": "http://www.obituaries.com/uploads/20201208/eaea75b1acab02914d319e7ba932f5ce.png", //店铺图
    "Title": "鑫茂店", //店铺名称
    "Content": "描述\r\n描述描述\r\n描述描述描述描述\r\n描述描述描述描述描述", //店铺描述
    },
    {
    "id": 3,
    "Image": "http://www.obituaries.com/uploads/20201208/eaea75b1acab02914d319e7ba932f5ce.png",
    "Title": "测试店铺",
    "Content": "描述 描述描述描述描述描述描述描述描述描述",
    },
    {
    "id": 2,
    "Image": "http://www.obituaries.com/uploads/20201208/eaea75b1acab02914d319e7ba932f5ce.png",
    "Title": "F作店",
    "Content": "描述\r\n描述描述\r\n描述描述描述\r\n描述描述描述描述",
    }
    ]
    }
    })
     */
    public function UserIndex()
    {
        $params = $this->request->param();
        //用户所在省市区
//        $UserAddress = $this->getCity($params['lng'], $params['lat']);
        if (empty($params['lng']) || $params['lng'] == '' || $params['lng'] == "" || $params['lng'] == null) {
            //首页轮播图
            $IndexBanner = [];
            $IndexBanner = Db::name('index_banner')->order('weigh desc')->field('id,image,web')->select();
            if (!empty($IndexBanner)) {
                foreach ($IndexBanner as $k => $v) {
                    $IndexBanner[$k]['image'] = $this->ImgUrl($v['image']);
                }
            }
            $data = [
                'IndexBanner' => $IndexBanner,
                'Count' => 0,
                'List' => []
            ];
        } else {
            $Map['address'] = ['LIKE', '%' . $params['city'] . '%'];
            $MapKey = [];
            if (!empty($params['keywords']) || $params['keywords'] != '' || $params['keywords'] != "" || $params['keywords'] != null) {
                $MapKey['title'] = ['LIKE', '%' . $params['keywords'] . '%'];
            }
            $SellerArray = Db::name('seller')->where($Map)->where($MapKey)->where('status', 0)->select();
            //首页轮播图
            $IndexBanner = [];
            $IndexBanner = Db::name('index_banner')->order('weigh desc')->field('id,image,web')->select();
            if (!empty($IndexBanner)) {
                foreach ($IndexBanner as $k => $v) {
                    $IndexBanner[$k]['image'] = $this->ImgUrl($v['image']);
                }
            }
            if (empty($SellerArray)) {
                $data = [
                    'IndexBanner' => $IndexBanner,
                    'Count' => 0,
                    'List' => []
                ];
            } else {
                foreach ($SellerArray as $k => $v) {
                    $List[$k]['id'] = $v['id'];
                    $List[$k]['Image'] = $this->ImgUrl($v['image']);
                    $List[$k]['Title'] = $v['title'];
                    $List[$k]['Content'] = $v['content'];
                    $List[$k]['Form'] = $this->getDistance($params['lng'], $params['lat'], $v['lng'], $v['lat']);
                }
                $newarr = array_column($List, 'Form');
                array_multisort($newarr, SORT_ASC, $List);
                $data = [
                    'IndexBanner' => $IndexBanner,
                    'Count' => count($SellerArray),
                    'List' => $this->page_array($params['rows'], $params['pages'], $List, 0)
                ];
            }
        }
        $this->success('成功', $data);
    }


    /**
     * 首页接口
     * @ApiTitle    (店铺详情)
     * @ApiSummary  (店铺详情)
     * @ApiMethod   (POST)
     * @ApiRoute    (/api/Index/SellerCon)
     * @ApiParams   (name="id", type="integer", required=true, description="店铺Id")
     * @ApiReturnParams   (name="code", type="integer", required=true, sample="0")
     * @ApiReturnParams   (name="msg", type="string", required=true, sample="返回成功")
     * @ApiReturn   ({
    'code':'1',
    'msg':'返回成功',
    "data": {
    "SellerConBanner": [ //轮播图
    {
    "id": 2,
    "image": "http://www.obituaries.com/uploads/20201208/eaea75b1acab02914d319e7ba932f5ce.png"
    },
    {
    "id": 1,
    "image": "http://www.obituaries.com/uploads/20201208/eaea75b1acab02914d319e7ba932f5ce.png"
    }
    ],
    "Title": "鑫茂店",
    "Name": "王先生",
    "Mobile": "13292442918",
    "Address": "天津市天津市西青区梓苑路",
    "Content": "描述\r\n描述描述\r\n描述描述描述描述\r\n描述描述描述描述描述"
    }
    })
     */
    public function SellerCon()
    {
        $Id = input('id');
        $SellerArray = Db::name('seller')->where('id', $Id)->where('status', 0)->find();
        if (empty($SellerArray)) {
            $this->error('店铺不存在', 0);
        }
        $SellerConBanner = [];
        $SellerConBanner = Db::name('seller_con_banner')->order('weigh desc')->field('id,image')->select();
        if (!empty($SellerConBanner)) {
            foreach ($SellerConBanner as $k => $v) {
                $SellerConBanner[$k]['image'] = $this->ImgUrl($v['image']);
            }
        }
        $data = [
            'SellerConBanner' => $SellerConBanner,
            'Title' => $SellerArray['title'],
            'Name' => $SellerArray['name'],
            'Mobile' => $SellerArray['mobile'],
            'Address' => $SellerArray['address'],
            'Content' => $SellerArray['content'],
        ];
        $this->success('成功', $data);
    }


    /**
     * 首页接口
     * @ApiTitle    (商户轮播图)
     * @ApiSummary  (商户轮播图)
     * @ApiMethod   (POST)
     * @ApiRoute    (/api/Index/SellerIndexBanner)
     * @ApiReturnParams   (name="code", type="integer", required=true, sample="0")
     * @ApiReturnParams   (name="msg", type="string", required=true, sample="返回成功")
     * @ApiReturn   ({
    'code':'1',
    'msg':'返回成功',
    "data": [
    {
    "id": 3,
    "image": "http://www.obituaries.com/uploads/20201208/eaea75b1acab02914d319e7ba932f5ce.png",
    "web": "https://www.baidu.com"
    },
    {
    "id": 2,
    "image": "http://www.obituaries.com/uploads/20201208/eaea75b1acab02914d319e7ba932f5ce.png",
    "web": "https://www.baidu.com"
    },
    {
    "id": 1,
    "image": "http://www.obituaries.com/uploads/20201208/eaea75b1acab02914d319e7ba932f5ce.png",
    "web": "https://www.baidu.com"
    }
    ]
    })
     */
    public function SellerIndexBanner()
    {
        //首页轮播图
        $IndexBanner = [];
        $IndexBanner = Db::name('index_banner')->order('weigh desc')->field('id,image,web')->select();
        if (!empty($IndexBanner)) {
            foreach ($IndexBanner as $k => $v) {
                $IndexBanner[$k]['image'] = $this->ImgUrl($v['image']);
            }
        }
        $this->success('成功', $IndexBanner);
    }


    /**
     * 首页接口
     * @ApiTitle    (商户公告)
     * @ApiSummary  (商户公告)
     * @ApiMethod   (POST)
     * @ApiRoute    (/api/Index/ContentList)
     * @ApiParams   (name="pages", type="string", required=true, description="pages")
     * @ApiParams   (name="rows", type="string", required=true, description="rows")
     * @ApiReturnParams   (name="code", type="integer", required=true, sample="0")
     * @ApiReturnParams   (name="msg", type="string", required=true, sample="返回成功")
     * @ApiReturn   ({
    'code':'1',
    'msg':'返回成功',
    "data": {
    "Count": 3, //数据总数
    "List": [
    {
    "Id": 3, //ID
    "Title": "giongyi1", 标题
    "Content": "<p>giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1giongyi1</p>",
    "Createtime": "2020-12-12 13:46:33"
    },
    {
    "Id": 2,
    "Title": "giongyi1giongyi1giongyi1giongyi1",
    "Content": "<p>giongyi1giongyi1giongyi1giongyi1giongyi1</p>", //内容
    "Createtime": "2020-12-12 13:46:29" //时间
    }
    ]
    }
    })
     */
    public function ContentList()
    {
        $Params = $this->request->param();
        $Array = Db::name('content')->order('createtime desc')->select();
        if (empty($Array)) {
            $data = [
                'Count' => 0,
                'List' => []
            ];
        } else {
            foreach ($Array as $k => $v) {
                $List[$k]['Id'] = $v['id'];
                $List[$k]['Title'] = $v['title'];
                $List[$k]['Content'] = $v['content'];
                $List[$k]['Createtime'] = date('Y-m-d H:i:s', $v['createtime']);
            }
            $data = [
                'Count' => count($List),
                'List' => $this->page_array($Params['rows'], $Params['pages'], $List, 0)
            ];
        }
        $this->success('成功', $data);
    }


    /**
     * 首页接口
     * @ApiTitle    (生成讣告)
     * @ApiSummary  (生成讣告)
     * @ApiMethod   (POST)
     * @ApiRoute    (/api/Index/UserAddOb)
     * @ApiHeaders  (name=token, type=string, required=false, description="请求的Token")
     * @ApiParams   (name="url", type="string", required=true, description="详情页URL 用于生成二维码扫码进入")
     * @ApiParams   (name="enmu", type="int", required=true, description="1=用户生成,2=商家生成")
     * @ApiParams   (name="status", type="int", required=true, description="1=新增,2=更改")
     * @ApiParams   (name="id", type="int", required=true, description="讣告ID,更改和讣告进度为2,3时传")
     * @ApiParams   (name="type", type="string", required=true, description="讣告进度:1=逝者信息,2=家属信息,3=选择模板")
     * @ApiParams   (name="title", type="string", required=true, description="讣告标题")
     * @ApiParams   (name="family_name", type="string", required=true, description="家属姓名")
     * @ApiParams   (name="family_mobile", type="string", required=true, description="家属联系方式")
     * @ApiParams   (name="call", type="string", required=true, description="称呼关系")
     * @ApiParams   (name="content", type="string", required=true, description="悼念文本")
     * @ApiParams   (name="portrait_image", type="string", required=true, description="遗像上传")
     * @ApiParams   (name="die_name", type="string", required=true, description="逝者姓名")
     * @ApiParams   (name="die_sex", type="string", required=true, description="逝者性别")
     * @ApiParams   (name="die_birthday", type="string", required=true, description="逝者生日")
     * @ApiParams   (name="die_time", type="string", required=true, description="逝世时间")
     * @ApiParams   (name="happy_year", type="string", required=true, description="享年")
     * @ApiParams   (name="go_out", type="string", required=true, description="出殡日期")
     * @ApiParams   (name="love_what", type="string", required=true, description="爱人情况")
     * @ApiParams   (name="hall_address", type="string", required=true, description="灵堂地点")
     * @ApiParams   (name="hall_lng", type="string", required=true, description="灵堂经度")
     * @ApiParams   (name="hall_lat", type="string", required=true, description="灵堂纬度")
     * @ApiParams   (name="mourn_address", type="string", required=true, description="追悼会地点")
     * @ApiParams   (name="mourn_lng", type="string", required=true, description="追悼会经度")
     * @ApiParams   (name="mourn_lat", type="string", required=true, description="追悼会纬度")
     * @ApiParams   (name="mourn_time", type="string", required=true, description="追悼会时间")
     * @ApiParams   (name="thank_address", type="string", required=true, description="答谢宴地点")
     * @ApiParams   (name="thank_lng", type="string", required=true, description="答谢宴经度")
     * @ApiParams   (name="thank_lat", type="string", required=true, description="答谢宴纬度")
     * @ApiParams   (name="thank_time", type="string", required=true, description="答谢宴时间")
     * @ApiParams   (name="after_images", type="string", required=true, description="生前照片/多张图,拼接字符串")
     * @ApiParams   (name="moban_id", type="string", required=true, description="模板12345678")
     * @ApiReturnParams   (name="code", type="integer", required=true, sample="0")
     * @ApiReturnParams   (name="msg", type="string", required=true, sample="返回成功")
     * @ApiReturn   ({
    'code':'1',
    'msg':'返回成功',
    "data": {
    "id": 1 //讣告进度type 为1 返回自增ID
    }
    })
     */
    public function UserAddOb()
    {
        $Params = $this->request->param();
        if ($Params['enmu'] == 1) {
            //用户
            $UserId = $this->IsToken($this->request->header());
        } else {
            //商家
            $SellerId = $this->IsTokenSeller($this->request->header());
        }
        //拦截
        if ($Params['status'] == 2) {
            if ($Params['enmu'] == 2) {
                $On = Db::name('ob')->where('id', $Params['id'])->value('on');
                if ($On == 1) {
                    $this->error('已发布讣告无法更改', 0);
                }
            }
        }
        if ($Params['type'] == 1) {
            if ($Params['status'] == 1) {
                if ($Params['enmu'] == 1) {
                    $data = [
                        'user_id' => $UserId,
                        'status' => 1,
                        'on' => 0,
                        'round_type' => 0,
                        'die_name' => $Params['die_name'],
                        'die_sex' => $Params['die_sex'],
                        'die_birthday' => $Params['die_birthday'],
                        'die_time' => $Params['die_time'],
                        'happy_year' => $Params['happy_year'],
                        'go_out' => $Params['go_out'],
                        'love_what' => $Params['love_what'],
                        'hall_address' => $Params['hall_address'],
                        'hall_lng' => $Params['hall_lng'],
                        'hall_lat' => $Params['hall_lat'],
                        'mourn_address' => $Params['mourn_address'],
                        'mourn_lng' => $Params['mourn_lng'],
                        'mourn_lat' => $Params['mourn_lat'],
                        'mourn_time' => $Params['mourn_time'],
                        'thank_address' => $Params['thank_address'],
                        'thank_lng' => $Params['thank_lng'],
                        'thank_lat' => $Params['thank_lat'],
                        'thank_time' => $Params['thank_time'],
                        'after_images' => $Params['after_images'],
                        'type' => 1,
                        'createtime' => time(),
                        'updatetime' => time()
                    ];
                } else {
                    $data = [
                        'seller_id' => $SellerId,
                        'status' => 2,
                        'type' => 1,
                        'on' => 0,
                        'round_type' => 0,
                        'die_name' => $Params['die_name'],
                        'die_sex' => $Params['die_sex'],
                        'die_birthday' => $Params['die_birthday'],
                        'die_time' => $Params['die_time'],
                        'happy_year' => $Params['happy_year'],
                        'go_out' => $Params['go_out'],
                        'love_what' => $Params['love_what'],
                        'hall_address' => $Params['hall_address'],
                        'hall_lng' => $Params['hall_lng'],
                        'hall_lat' => $Params['hall_lat'],
                        'mourn_address' => $Params['mourn_address'],
                        'mourn_lng' => $Params['mourn_lng'],
                        'mourn_lat' => $Params['mourn_lat'],
                        'mourn_time' => $Params['mourn_time'],
                        'thank_address' => $Params['thank_address'],
                        'thank_lng' => $Params['thank_lng'],
                        'thank_lat' => $Params['thank_lat'],
                        'thank_time' => $Params['thank_time'],
                        'after_images' => $Params['after_images'],
                        'createtime' => time(),
                        'updatetime' => time()
                    ];
                }
                $Res = Db::name('ob')->insert($data);
                $Id = Db::name('ob')->where(['die_name' => $Params['die_name'],
                    'die_sex' => $Params['die_sex'],
                    'die_birthday' => $Params['die_birthday'],
                    'die_time' => $Params['die_time'],
                    'happy_year' => $Params['happy_year'],
                    'go_out' => $Params['go_out'],
                    'love_what' => $Params['love_what'],
                    'hall_address' => $Params['hall_address'],
                    'hall_lng' => $Params['hall_lng'],
                    'hall_lat' => $Params['hall_lat'],
                    'mourn_address' => $Params['mourn_address'],
                    'mourn_lng' => $Params['mourn_lng'],
                    'mourn_lat' => $Params['mourn_lat'],
                    'mourn_time' => $Params['mourn_time'],
                    'thank_address' => $Params['thank_address'],
                    'thank_lng' => $Params['thank_lng'],
                    'thank_lat' => $Params['thank_lat'],
                    'thank_time' => $Params['thank_time'],
                    'after_images' => $Params['after_images'],
                    'type' => 1,
                    'createtime' => time(),
                    'updatetime' => time()])->order('id desc')->value('id');
                //生成二维码
                $this->scerweima($Id, 'ob_id=' . $Id);
                Db::name('ob')->where('id', $Id)->update([
                    'qrcode_image' => '/images/' . $Id . '.png'
                ]);
            } else {
                $data = [
                    'die_name' => $Params['die_name'],
                    'die_sex' => $Params['die_sex'],
                    'die_birthday' => $Params['die_birthday'],
                    'die_time' => $Params['die_time'],
                    'happy_year' => $Params['happy_year'],
                    'go_out' => $Params['go_out'],
                    'love_what' => $Params['love_what'],
                    'hall_address' => $Params['hall_address'],
                    'hall_lng' => $Params['hall_lng'],
                    'hall_lat' => $Params['hall_lat'],
                    'mourn_address' => $Params['mourn_address'],
                    'mourn_lng' => $Params['mourn_lng'],
                    'mourn_lat' => $Params['mourn_lat'],
                    'mourn_time' => $Params['mourn_time'],
                    'thank_address' => $Params['thank_address'],
                    'thank_lng' => $Params['thank_lng'],
                    'thank_lat' => $Params['thank_lat'],
                    'thank_time' => $Params['thank_time'],
                    'after_images' => $Params['after_images'],
                    'updatetime' => time()
                ];
                $Res = Db::name('ob')->where('id', $Params['id'])->update($data);
            }
        } elseif ($Params['type'] == 2) {
            if ($Params['status'] == 1) {
                $data = [
                    'title' => $Params['title'],
                    'family_name' => $Params['family_name'],
                    'family_mobile' => $Params['family_mobile'],
                    'call' => $Params['call'],
                    'content' => $Params['content'],
                    'portrait_image' => $Params['portrait_image'],
                    'updatetime' => time()
                ];
            } else {
                $data = [
                    'title' => $Params['title'],
                    'family_name' => $Params['family_name'],
                    'family_mobile' => $Params['family_mobile'],
                    'call' => $Params['call'],
                    'content' => $Params['content'],
                    'portrait_image' => $Params['portrait_image'],
                    'updatetime' => time()
                ];
            }
            $Res = Db::name('ob')->where('id', $Params['id'])->update($data);
        } elseif ($Params['type'] == 3) {
            if ($Params['status'] == 1) {
                if ($Params['enmu'] == 1) {
                    $data = [
                        'moban_id' => $Params['moban_id'],
                        'updatetime' => time(),
                        'type' => 4,
                        'on' => 1
                    ];
                    //添加讣告发布成功消息
                    $MessageData = [
                        'user_id' => $UserId,
                        'touser_id' => $UserId,
                        'type' => 1,
                        'ob_id' => $Params['id'],
                        'createtime' => time()
                    ];
                    Db::name('message')->insert($MessageData);
                } else {
                    //生成二维码
                    $this->scerweima($Params['id'], $Params['url'] . '?ob_id=' . $Params['id']);
                    Db::name('ob')->where('id', $Params['id'])->update([
                        'qrcode_image' => '/images/' . $Params['id'] . '.png'
                    ]);
                    $data = [
                        'moban_id' => $Params['moban_id'],
                        'updatetime' => time(),
                        'type' => 4,
                    ];
                }
            } else {
                $data = [
                    'moban_id' => $Params['moban_id'],
                    'updatetime' => time(),
                ];
            }
            $Res = Db::name('ob')->where('id', $Params['id'])->update($data);
        }
        if (!$Res) {
            $this->error('失败', 0);
        } else {
            if ($Params['type'] == 1 && $Params['status'] == 1) {
                $this->success('成功', ['id' => $Id]);
            } else {
                $this->success('成功', 1);
            }
        }
    }


    /**
     * 首页接口
     * @ApiTitle    (讣告回显)
     * @ApiSummary  (讣告回显)
     * @ApiMethod   (POST)
     * @ApiRoute    (/api/Index/ObBack)
     * @ApiParams   (name="ob_id", type="int", required=true, description="讣告ID")
     * @ApiReturnParams   (name="code", type="integer", required=true, sample="0")
     * @ApiReturnParams   (name="msg", type="string", required=true, sample="返回成功")
     * @ApiReturn   ({
    'code':'1',
    'msg':'返回成功',
    "data": {
    "id": 1,
    "status": 1,  //讣告类型:1=用户生成,2=商家生成
    "type": 4,  //讣告进度:1=家属信息,2=逝者信息,3=选择模板,4=填写完毕
    "on": 1,  //发布状态:0=未发布,1=已发布
    "seller_id": null,  //商家
    "user_id": 1,  //用户
    "title": "测试讣告12222222", //讣告标题
    "family_name": "加属姓名", //家属姓名
    "family_mobile": "13292442918", //家属联系方式
    "call": "称呼关系",
    "content": "悼念文本",
    "portrait_image": "http://www.obituaries.com/uploads/20201215/FgXiESiI34OYz6UIHwYzYIiZ0SqT.png",  //遗像上传
    "die_name": "逝者姓名",
    "die_sex": "男",
    "die_birthday": "2020-20-20",  //逝者生日
    "die_time": "2020-20-20", //逝世时间
    "happy_year": "11", //享年
    "go_out": 2020, //出殡日期
    "love_what": "airenqingkuang", //爱人情况
    "hall_address": "sadasdasda", //灵堂地点
    "hall_lng": "123",
    "hall_lat": "2312",
    "mourn_address": "asdad",  //追悼会地点
    "mourn_lng": "123",
    "mourn_lat": "123",
    "mourn_time": 2020-10-12,   //追悼会时间
    "thank_address": "12321312",  //答谢宴地点
    "thank_lng": "123123",
    "thank_lat": "123123123",
    "thank_time": 2020-10-12,  //答谢宴时间
    "after_images": [  //生前照片 数组
    "http://www.obituaries.com123213"
    ],
    "createtime": 0,
    "updatetime": 1608009999,
    "moban_id": 1, 模板
    "round_type": 0, 是否转发
    "qrcode_image": "http://www.obituaries.com/images/1.png"  二维码
    }
    })
     */
    public function ObBack()
    {
        $Params = $this->request->param();
        $Array = Db::name('ob')
            ->where('id', $Params['ob_id'])
            ->find();
        if (empty($Array)) {
            $this->error('参数错误');
        }
        $Array['portrait_image2'] = $Array['portrait_image'];
        $Array['portrait_image'] = $this->ImgUrl($Array['portrait_image']);
        if (strstr($Array['after_images'], ',')) {
            $AfterImg = explode(',', $Array['after_images']);
            $AfterImg2 = explode(',', $Array['after_images']);
        } else {
            $AfterImg = explode(' ', $Array['after_images']);
            $AfterImg2 = explode(' ', $Array['after_images']);
        }
        foreach ($AfterImg as $k => $v) {
            $AfterImg[$k] = $this->ImgUrl($v);
        }
        $Array['after_images'] = $AfterImg;
        $Array['after_images2'] = $AfterImg2;
        $Array['qrcode_image'] = $this->ImgUrl($Array['qrcode_image']);
        $this->success('成功', $Array);
    }


    /**
     * 首页接口
     * @ApiTitle    (用户端讣告管理)
     * @ApiSummary  (用户端讣告管理)
     * @ApiMethod   (POST)
     * @ApiRoute    (/api/Index/UserObList)
     * @ApiHeaders  (name=token, type=string, required=false, description="请求的Token")
     * @ApiParams   (name="type", type="int", required=true, description="1=我的讣告,2=转发讣告")
     * @ApiParams   (name="pages", type="int", required=true, description="pages")
     * @ApiParams   (name="rows", type="int", required=true, description="rows")
     * @ApiReturnParams   (name="code", type="integer", required=true, sample="0")
     * @ApiReturnParams   (name="msg", type="string", required=true, sample="返回成功")
     * @ApiReturn   ({
    'code':'1',
    'msg':'返回成功',
    "data": {
    "Count": 1,
    "List": [
    {
    "Id": 1,
    "PortraitImage": "http://www.obituaries.com/uploads/20201215/FgXiESiI34OYz6UIHwYzYIiZ0SqT.png",
    "Title": "测试讣告12222222", //讣告标题
    "Type": 4,  //讣告进度:1=家属信息,2=逝者信息,3=选择模板,4=填写完毕
    "On": 1,  //发布状态:0=未发布,1=已发布
    "Nickname": "111", 微信名
    "Createtime": "1970-01-01 08:00:00"
    }
    ]
    }
    })
     */
    public function UserObList()
    {
        $UserId = $this->IsToken($this->request->header());
        $Params = $this->request->param();
        if ($Params['type'] == 1) {
            $Array = Db::name('ob')
                ->where('user_id', $UserId)
                ->order('createtime desc')
                ->alias('o')
                ->join('user u', 'u.id=o.user_id')
                ->field('o.id,portrait_image,u.nickname,title,type,on,o.createtime,o.moban_id')
                ->select();
        } else {
            $Array = Db::name('for_ob')
                ->alias('f')
                ->where('f.user_id', $UserId)
                ->join('ob o', 'o.id=f.ob_id')
                ->join('user u', 'u.id=o.user_id')
                ->order('f.createtime desc')
                ->field('o.id,o.portrait_image,u.nickname,o.title,o.type,o.on,o.createtime,o.moban_id')
                ->select();
        }
        if (empty($Array)) {
            $data = [
                'Count' => 0,
                'List' => []
            ];
        } else {
            foreach ($Array as $k => $v) {
                $List[$k]['Id'] = $v['id'];
                $List[$k]['PortraitImage'] = $this->ImgUrl($v['portrait_image']);
                $List[$k]['Title'] = $v['title'];
                $List[$k]['Type'] = $v['type'];
                $List[$k]['On'] = $v['on'];
                $List[$k]['Mobanid'] = $v['moban_id'];
                $List[$k]['Nickname'] = $v['nickname'];
                $List[$k]['Createtime'] = date('Y-m-d H:i:s', $v['createtime']);
            }
            $data = [
                'Count' => count($List),
                'List' => $this->page_array($Params['rows'], $Params['pages'], $List, 0)
            ];
        }
        $this->success('成功', $data);
    }


    /**
     * 首页接口
     * @ApiTitle    (商户端讣告管理)
     * @ApiSummary  (商户端讣告管理)
     * @ApiMethod   (POST)
     * @ApiRoute    (/api/Index/SellerObList)
     * @ApiHeaders  (name=token, type=string, required=false, description="请求的Token")
     * @ApiParams   (name="type", type="int", required=true, description="1=未确认,2=未发布,3=已完成")
     * @ApiParams   (name="pages", type="int", required=true, description="pages")
     * @ApiParams   (name="rows", type="int", required=true, description="rows")
     * @ApiReturnParams   (name="code", type="integer", required=true, sample="0")
     * @ApiReturnParams   (name="msg", type="string", required=true, sample="返回成功")
     * @ApiReturn   ({
    'code':'1',
    'msg':'返回成功',
    "data": {
    "Count": 1,
    "List": [
    {
    "Id": 4,
    "PortraitImage": "http://www.obituaries.com3123123", //遗像
    "DieName": "12312312", //姓名
    "DieSex": "3123213", //性别
    "Dietime": "123213", //逝世时间
    "Createtime": "1970-01-01"
    }
    ]
    }
    })
     */
    public function SellerObList()
    {
        $SellerId = $this->IsTokenSeller($this->request->header());
        $Params = $this->request->param();
        if ($Params['type'] == 1) {
            $Map['round_type'] = ['EQ', 0];
        } elseif ($Params['type'] == 2) {
            $Map['on'] = ['EQ', 0];
            $Map['round_type'] = ['EQ', 1];
        } elseif ($Params['type'] == 3) {
            $Map['on'] = ['EQ', 1];
        }
        $Array = Db::name('ob')
            ->where('seller_id', $SellerId)
            ->where($Map)
            ->order('id desc')
            ->select();
        if (empty($Array)) {
            $data = [
                'Count' => 0,
                'List' => []
            ];
        } else {
            foreach ($Array as $k => $v) {
                $List[$k]['Id'] = $v['id'];
                $List[$k]['PortraitImage'] = $this->ImgUrl($v['portrait_image']);
                $List[$k]['DieName'] = $v['die_name'];
                $List[$k]['DieSex'] = $v['die_sex'];
                $List[$k]['Dietime'] = $v['die_time'];
                $List[$k]['MoBanId'] = $v['moban_id'];
                $List[$k]['RoundType'] = $v['round_type'];
                $List[$k]['Createtime'] = date('Y-m-d', $v['createtime']);
            }
            $data = [
                'Count' => count($List),
                'List' => $this->page_array($Params['rows'], $Params['pages'], $List, 0)
            ];
        }
        $this->success('成功', $data);
    }


    /**
     * 首页接口
     * @ApiTitle    (收益明细)
     * @ApiSummary  (收益明细)
     * @ApiMethod   (POST)
     * @ApiRoute    (/api/Index/UserPriceList)
     * @ApiHeaders  (name=token, type=string, required=false, description="请求的Token")
     * @ApiParams   (name="type", type="int", required=true, description="1=收益明细,2=提现记录")
     * @ApiParams   (name="pages", type="int", required=true, description="pages")
     * @ApiParams   (name="rows", type="int", required=true, description="rows")
     * @ApiReturnParams   (name="code", type="integer", required=true, sample="0")
     * @ApiReturnParams   (name="msg", type="string", required=true, sample="返回成功")
     * @ApiReturn   ({
    'code':'1',
    'msg':'返回成功',
    })
     */
    public function UserPriceList()
    {
        $UserId = $this->IsToken($this->request->header());
        $Params = $this->request->param();
        if ($Params['type'] == 1) {
            //收益明细
            $Array = Db::name('message')->where('touser_id', $UserId)->where('type', 3)->order('createtime desc')->field('id,name,mobile,money,content,createtime')->select();
        } else {
            //提现记录
            $Array = Db::name('tixian')->where('user_id', $UserId)->order('createtime desc')->field('id,money,status,createtime')->select();
        }
        if (empty($Array)) {
            $data = [
                'Count' => 0,
                'List' => []
            ];
        } else {
            foreach ($Array as $k => $v) {
                $Array[$k]['Createtime'] = date('Y-m-d H:i:s', $v['createtime']);
            }
            $data = [
                'Count' => count($Array),
                'List' => $this->page_array($Params['rows'], $Params['pages'], $Array, 0)
            ];
        }
        $this->success('成功', $data);
    }


    /**
     * 首页接口
     * @ApiTitle    (客户管理)
     * @ApiSummary  (客户管理)
     * @ApiMethod   (POST)
     * @ApiRoute    (/api/Index/BusinessList)
     * @ApiHeaders  (name=token, type=string, required=false, description="请求的Token")
     * @ApiParams   (name="pages", type="int", required=true, description="pages")
     * @ApiParams   (name="rows", type="int", required=true, description="rows")
     * @ApiReturnParams   (name="code", type="integer", required=true, sample="0")
     * @ApiReturnParams   (name="msg", type="string", required=true, sample="返回成功")
     * @ApiReturn   ({
    'code':'1',
    'msg':'返回成功',
    })
     */
    public function BusinessList()
    {
        $SellerId = $this->IsTokenSeller($this->request->header());
        $Params = $this->request->param();
        $Array = Db::name('business')->where('seller_id', $SellerId)
            ->alias('b')
            ->join('user u', 'u.id=b.user_id')
            ->order('b.createtime desc')
            ->field('b.id,b.user_id,u.avatar,u.nickname,b.createtime')
            ->select();
        if (empty($Array)) {
            $data = [
                'Count' => 0,
                'List' => []
            ];
        } else {
            foreach ($Array as $k => $v) {
                $List[$k]['Id'] = $v['id'];
                $List[$k]['Avatar'] = $v['avatar'];
                $List[$k]['Nickname'] = $v['nickname'];
                $List[$k]['Mobile'] = Db::name('ob')->where('user_id', $v['user_id'])->value('family_mobile');
                $ObNum = Db::name('ob')->where('user_id', $v['user_id'])->order('id desc')->select();
                $List[$k]['ObNum'] = count($ObNum);
                $List[$k]['Createtime'] = date('Y-m-d', $v['createtime']);
                foreach ($ObNum as $key => $value) {
                    $List[$k]['ObArray'][$key]['ObId'] = $value['id'];
                    $List[$k]['ObArray'][$key]['DieName'] = $value['die_name'];
                    $List[$k]['ObArray'][$key]['DieSex'] = $value['die_sex'];
                    $List[$k]['ObArray'][$key]['DieBirthday'] = $value['die_birthday'];
                    $List[$k]['ObArray'][$key]['Dietime'] = $value['die_time'];
                }
            }
            $data = [
                'Count' => count($List),
                'List' => $this->page_array($Params['rows'], $Params['pages'], $List, 0)
            ];
        }
        $this->success('成功', $data);
    }


    /**
     * 首页接口
     * @ApiTitle    (讣告详情)
     * @ApiSummary  (讣告详情)
     * @ApiMethod   (POST)
     * @ApiRoute    (/api/Index/ObCon)
     * @ApiParams   (name="ob_id", type="int", required=true, description="讣告ID")
     * @ApiReturnParams   (name="code", type="integer", required=true, sample="0")
     * @ApiReturnParams   (name="msg", type="string", required=true, sample="返回成功")
     * @ApiReturn   ({
    'code':'1',
    'msg':'返回成功',
    "data": {
    "PortraitImage": "http://www.obituaries.com/uploads/20201215/FgXiESiI34OYz6UIHwYzYIiZ0SqT.png", //遗像
    "Title": "测试讣告12222222", //讣告标题
    "Content": "悼念文本",
    "FamilyName": "加属姓名",
    "FamilyMobile": "13292442918",
    "Createtime": "1970-01-01",
    "AfterImages": [
    "http://www.obituaries.com/123213"  //省钱照片数组
    ],
    "hall_address": "sadasdasda",  //灵堂地点
    "hall_lng": "123",  //
    "hall_lat": "2312", //经纬度
    "mourn_address": "asdad", //悼念会地点
    "mourn_lng": "123",
    "mourn_lat": "123",
    "mourn_time": 45343123,  //悼念时间
    "thank_address": "12321312",  //答谢地点
    "thank_lng": "123123",
    "thank_lat": "123123123",
    "thank_time": 123123,  //答谢时间
    "GiftArray": [  //礼物/留言数组
    {
    "Id": 6,
    "Nickname": "111",  //微信名
    "Avatar": "1111", //头像
    "Image": "http://www.obituaries.com/uploads/20201215/FgXiESiI34OYz6UIHwYzYIiZ0SqT.png", //礼物图
    "Title": "鲜花", //礼物名称
    "Message": "测试送礼", //留言
    "Createtime": "2020-12-15 13:40:08" //时间
    }
    ],
    "SellerArray": {  //商家信息
    "Image": "http://www.obituaries.com/uploads/20201214/eaea75b1acab02914d319e7ba932f5ce.png", //图
    "title": "华斯服务商", //镖旗
    "Address": "北京市北京市朝阳区建国路", //地址
    "Content": "一条龙", //简介
    "Lat": "39.91053",
    "Lng": "116.51344"
    },
    "ObBanner": [ //底部轮播图
    {
    "Id": 2,
    "Image": "http://www.obituaries.com/uploads/20201215/FgXiESiI34OYz6UIHwYzYIiZ0SqT.png",  //图片
    "Web": "https://www.baidu.com"  //外联
    },
    {
    "Id": 1,
    "Image": "http://www.obituaries.com/uploads/20201215/FgXiESiI34OYz6UIHwYzYIiZ0SqT.png",
    "Web": "https://www.baidu.com"
    },
    {
    "Id": 3,
    "Image": "http://www.obituaries.com/uploads/20201215/FgXiESiI34OYz6UIHwYzYIiZ0SqT.png",
    "Web": "https://www.baidu.com"
    }
    ]
    }
    })
     */
    public function ObCon()
    {
//        $UserId = $this->IsToken($this->request->header());
        $Params = $this->request->param();
        $Array = Db::name('ob')->where('id', $Params['ob_id'])->find();
        if (empty($Array)) {
            $this->error('参数错误', 0);
        }
        if (strstr($Array['after_images'], ',')) {
            $AfterImages = explode(',', $Array['after_images']);
        } else {
            $AfterImages = explode(' ', $Array['after_images']);
        }
        foreach ($AfterImages as $k => $v) {
            $AfterImages[$k] = $this->ImgUrl($v);
        }
        //gift数组
        $GiftsArray = Db::name('message')
            ->alias('m')
            ->where('m.ob_id', $Params['ob_id'])
            ->where('m.type', 2)
            ->order('m.id desc')
            ->join('gift g', 'g.id=m.gift_id')
            ->join('user u', 'u.id=m.user_id')
            ->field('m.id,u.nickname,u.avatar,g.image,g.title,m.createtime,m.message')
            ->select();
        if (empty($GiftsArray)) {
            $Gift = [];
        } else {
            foreach ($GiftsArray as $k => $v) {
                $Gift[$k]['Id'] = $v['id'];
                $Gift[$k]['Nickname'] = $v['nickname'];
                $Gift[$k]['Avatar'] = $v['avatar'];
                $Gift[$k]['Image'] = $this->ImgUrl($v['image']);
                $Gift[$k]['Title'] = $v['title'];
                $Gift[$k]['Message'] = $v['message'];
                $Gift[$k]['Createtime'] = DATE('Y-m-d H:i:s', $v['createtime']);
            }
        }
        //商家
        if (empty($Array['seller_id']) || $Array['seller_id'] == '' || $Array['seller_id'] == null) {
            $SellerArray = Db::name('kefu')->where('id', 1)->find();
        } else {
            $SellerArray = Db::name('seller')->where('id', $Array['seller_id'])->find();
        }
        $Seller['Image'] = $this->ImgUrl($SellerArray['image']);
        $Seller['title'] = $SellerArray['title'];
        $Seller['Address'] = $SellerArray['address'];
        $Seller['Content'] = $SellerArray['content'];
        $Seller['Lat'] = $SellerArray['lat'];
        $Seller['Lng'] = $SellerArray['lng'];
        $Seller['Mobile'] = $SellerArray['mobile'];
        //轮播图
        $ObBannerArray = Db::name('ob_banner')->order('weigh desc')->select();
        $ObBanner = [];
        if (!empty($ObBannerArray)) {
            foreach ($ObBannerArray as $k => $v) {
                $ObBanner[$k]['Id'] = $v['id'];
                $ObBanner[$k]['Image'] = $this->ImgUrl($v['image']);
                $ObBanner[$k]['Web'] = $v['web'];
            }
        }
        $List = [
            'PortraitImage' => $this->ImgUrl($Array['portrait_image']),
            'Title' => $Array['title'],
            'Content' => $Array['content'],
            'FamilyName' => $Array['family_name'],
            'FamilyMobile' => $Array['family_mobile'],
            'Createtime' => date('Y-m-d', $Array['createtime']),
            'AfterImages' => $AfterImages,
            'hall_address' => $Array['hall_address'],
            'hall_lng' => $Array['hall_lng'],
            'hall_lat' => $Array['hall_lat'],
            'mourn_address' => $Array['mourn_address'],
            'mourn_lng' => $Array['mourn_lng'],
            'mourn_lat' => $Array['mourn_lat'],
            'mourn_time' => $Array['mourn_time'],
            'thank_address' => $Array['thank_address'],
            'thank_lng' => $Array['thank_lng'],
            'thank_lat' => $Array['thank_lat'],
            'thank_time' => $Array['thank_time'],
            'GiftArray' => $Gift,
            'SellerArray' => $Seller,
            'ObBanner' => $ObBanner
        ];
        $this->success('成功', $List);
    }


    /**
     * 首页接口
     * @ApiTitle    (我的消息)
     * @ApiSummary  (我的消息)
     * @ApiMethod   (POST)
     * @ApiRoute    (/api/Index/MyMessage)
     * @ApiHeaders  (name=token, type=string, required=false, description="请求的Token")
     * @ApiParams   (name="pages", type="int", required=true, description="pages")
     * @ApiParams   (name="rows", type="int", required=true, description="rows")
     * @ApiReturnParams   (name="code", type="integer", required=true, sample="0")
     * @ApiReturnParams   (name="msg", type="string", required=true, sample="返回成功")
     * @ApiReturn   ({
    'code':'1',
    'msg':'返回成功',
    })
     */
    public function MyMessage()
    {
        $UserId = $this->IsToken($this->request->header());
        $Params = $this->request->param();
        //gift数组
        $GiftsArray = Db::name('message')
            ->where('touser_id', $UserId)
            ->order('id desc')
            ->select();
        if (empty($GiftsArray)) {
            $data = [
                'Count' => 0,
                'List' => []
            ];
        } else {
            foreach ($GiftsArray as $k => $v) {
                $Gift[$k]['Id'] = $v['id'];
                $Gift[$k]['Nickname'] = Db::name('user')->where('id', $v['user_id'])->value('nickname');
                $Gift[$k]['Avatar'] = Db::name('user')->where('id', $v['user_id'])->value('avatar');
                $Gift[$k]['Type'] = $v['type'];
                if ($v['type'] == 1) {
                    $Gift[$k]['ObName'] = Db::name('ob')->where('id', $v['ob_id'])->value('title');
                } elseif ($v['type'] == 2) {
                    $GiftArray = Db::name('gift')->where('id', $v['gift_id'])->find();
                    $Gift[$k]['Image'] = $this->ImgUrl($GiftArray['image']);
                    $Gift[$k]['Title'] = $this->ImgUrl($GiftArray['title']);
                } elseif ($v['type'] == 3) {
                    $Gift[$k]['Name'] = $v['name'];
                    $Gift[$k]['Mobile'] = $v['mobile'];
                    $Gift[$k]['Money'] = $v['money'];
                    $Gift[$k]['Content'] = $v['content'];
                }
                $Gift[$k]['Createtime'] = DATE('Y-m-d H:i:s', $v['createtime']);
            }
            $data = [
                'Count' => count($Gift),
                'List' => $this->page_array($Params['rows'], $Params['pages'], $Gift, 0)
            ];
        }
        $this->success('成功', $data);
    }


    /**
     * 首页接口
     * @ApiTitle    (删除未发布讣告)
     * @ApiSummary  (删除未发布讣告)
     * @ApiMethod   (POST)
     * @ApiRoute    (/api/Index/DelUserOb)
     * @ApiHeaders  (name=token, type=string, required=false, description="请求的Token")
     * @ApiParams   (name="ob_id", type="int", required=true, description="讣告ID")
     * @ApiReturnParams   (name="code", type="integer", required=true, sample="0")
     * @ApiReturnParams   (name="msg", type="string", required=true, sample="返回成功")
     * @ApiReturn   ({
    'code':'1',
    'msg':'返回成功',
    })
     */
    public function DelUserOb()
    {
        $UserId = $this->IsToken($this->request->header());
        $Params = $this->request->param();
        $ObInfo = Db::name('ob')->where('id', $Params['ob_id'])->find();
        if ($ObInfo['on'] == 1) {
            $this->error('已发布无法删除');
        }
        $Res = Db::name('ob')->where('user_id', $UserId)->where('id', $Params['ob_id'])->delete();
        $this->Res($Res);
    }
}