Browse Source

commit message

test 4 năm trước cách đây
commit
aa5f51ba92
100 tập tin đã thay đổi với 9706 bổ sung0 xóa
  1. 316 0
      doc/app源码目录.md
  2. 8 0
      doc/bug.md
  3. 2 0
      server/addons/hyb_o2o/.idea/.gitignore
  4. 2 0
      server/addons/hyb_o2o/1.txt
  5. 8 0
      server/addons/hyb_o2o/Lib/YLYConfigClient.php
  6. 25 0
      server/addons/hyb_o2o/Lib/YLYHttpClient.php
  7. 106 0
      server/addons/hyb_o2o/Lib/YLYOpenApiClient.php
  8. 18 0
      server/addons/hyb_o2o/Lib/YLYSignAndUuidClient.php
  9. 21 0
      server/addons/hyb_o2o/Lib/YLYTokenClient.php
  10. 13 0
      server/addons/hyb_o2o/Lib/getTokenDemo.php
  11. 20 0
      server/addons/hyb_o2o/Lib/printDemo.php
  12. 54 0
      server/addons/hyb_o2o/SmsDemo.php
  13. 100 0
      server/addons/hyb_o2o/admin/common/attachurl.php
  14. 273 0
      server/addons/hyb_o2o/admin/common/bootstrap.sys.inc.php
  15. 330 0
      server/addons/hyb_o2o/admin/common/common.func.php
  16. 85 0
      server/addons/hyb_o2o/admin/common/template.func.php
  17. 144 0
      server/addons/hyb_o2o/admin/index.php
  18. 31 0
      server/addons/hyb_o2o/admin/source/site/entry.ctrl.php
  19. 32 0
      server/addons/hyb_o2o/admin/source/user/login.ctrl.php
  20. 14 0
      server/addons/hyb_o2o/admin/source/user/logout.ctrl.php
  21. 7 0
      server/addons/hyb_o2o/admin/source/utility/__init.php
  22. 8 0
      server/addons/hyb_o2o/admin/themes/default/common/footer-base.html
  23. 33 0
      server/addons/hyb_o2o/admin/themes/default/common/footer-cms.html
  24. 54 0
      server/addons/hyb_o2o/admin/themes/default/common/footer-gw.html
  25. 71 0
      server/addons/hyb_o2o/admin/themes/default/common/footer.html
  26. 44 0
      server/addons/hyb_o2o/admin/themes/default/common/header-base.html
  27. 136 0
      server/addons/hyb_o2o/admin/themes/default/common/header-cms.html
  28. 59 0
      server/addons/hyb_o2o/admin/themes/default/common/header-gw.html
  29. 219 0
      server/addons/hyb_o2o/admin/themes/default/common/header.html
  30. 8 0
      server/addons/hyb_o2o/admin/themes/default/common/message.html
  31. 285 0
      server/addons/hyb_o2o/admin/themes/default/user/login.html
  32. 52 0
      server/addons/hyb_o2o/config.php
  33. 206 0
      server/addons/hyb_o2o/cron.php
  34. 10 0
      server/addons/hyb_o2o/errorCode.php
  35. BIN
      server/addons/hyb_o2o/icon-custom.jpg
  36. BIN
      server/addons/hyb_o2o/icon.jpg
  37. 50 0
      server/addons/hyb_o2o/inc/func/SignatureHelper.php
  38. 20 0
      server/addons/hyb_o2o/inc/func/app_menu.php
  39. 185 0
      server/addons/hyb_o2o/inc/func/core.php
  40. 172 0
      server/addons/hyb_o2o/inc/func/functions.php
  41. 376 0
      server/addons/hyb_o2o/inc/lib/WxPay.Api.php
  42. 14 0
      server/addons/hyb_o2o/inc/lib/WxPay.Config.Interface.php
  43. 62 0
      server/addons/hyb_o2o/inc/lib/WxPay.Config.php
  44. 1443 0
      server/addons/hyb_o2o/inc/lib/WxPay.Data.php
  45. 9 0
      server/addons/hyb_o2o/inc/lib/WxPay.Exception.php
  46. 114 0
      server/addons/hyb_o2o/inc/lib/WxPay.JsApiPay.php
  47. 52 0
      server/addons/hyb_o2o/inc/lib/WxPay.Notify.php
  48. 26 0
      server/addons/hyb_o2o/inc/lib/apiclient_cert.pem
  49. 28 0
      server/addons/hyb_o2o/inc/lib/apiclient_key.pem
  50. 41 0
      server/addons/hyb_o2o/inc/mobile/add_aditor.inc.php
  51. 36 0
      server/addons/hyb_o2o/inc/mobile/address.inc.php
  52. 90 0
      server/addons/hyb_o2o/inc/mobile/all.inc.php
  53. 31 0
      server/addons/hyb_o2o/inc/mobile/all.php
  54. 30 0
      server/addons/hyb_o2o/inc/mobile/all_type.inc.php
  55. 54 0
      server/addons/hyb_o2o/inc/mobile/amount_water.inc.php
  56. 42 0
      server/addons/hyb_o2o/inc/mobile/apply_distributor.inc.php
  57. 47 0
      server/addons/hyb_o2o/inc/mobile/apply_refund.inc.php
  58. 11 0
      server/addons/hyb_o2o/inc/mobile/barcode_scan.inc.php
  59. 276 0
      server/addons/hyb_o2o/inc/mobile/base.inc.php
  60. 11 0
      server/addons/hyb_o2o/inc/mobile/binding_phone.inc.php
  61. 10 0
      server/addons/hyb_o2o/inc/mobile/business_page.inc.php
  62. 10 0
      server/addons/hyb_o2o/inc/mobile/business_pages.inc.php
  63. 21 0
      server/addons/hyb_o2o/inc/mobile/buy_vip.inc.php
  64. 20 0
      server/addons/hyb_o2o/inc/mobile/card_main.inc.php
  65. 36 0
      server/addons/hyb_o2o/inc/mobile/cardarr.inc.php
  66. 54 0
      server/addons/hyb_o2o/inc/mobile/cardwrap.inc.php
  67. 10 0
      server/addons/hyb_o2o/inc/mobile/changeword.inc.php
  68. 33 0
      server/addons/hyb_o2o/inc/mobile/deposit_record.inc.php
  69. 2 0
      server/addons/hyb_o2o/inc/mobile/deposit_rocord.inc.php
  70. 174 0
      server/addons/hyb_o2o/inc/mobile/detail.inc.php
  71. 11 0
      server/addons/hyb_o2o/inc/mobile/detail.php
  72. 207 0
      server/addons/hyb_o2o/inc/mobile/distributer_page.inc.php
  73. 43 0
      server/addons/hyb_o2o/inc/mobile/employ_page.inc.php
  74. 13 0
      server/addons/hyb_o2o/inc/mobile/fa_detail.inc.php
  75. 29 0
      server/addons/hyb_o2o/inc/mobile/fabu.inc.php
  76. 468 0
      server/addons/hyb_o2o/inc/mobile/fabu_main.inc.php
  77. 101 0
      server/addons/hyb_o2o/inc/mobile/find.inc.php
  78. 10 0
      server/addons/hyb_o2o/inc/mobile/first_yuyue.inc.php
  79. 483 0
      server/addons/hyb_o2o/inc/mobile/fuwu_list.inc.php
  80. 241 0
      server/addons/hyb_o2o/inc/mobile/fw_refill.inc.php
  81. 41 0
      server/addons/hyb_o2o/inc/mobile/fxyj.inc.php
  82. 73 0
      server/addons/hyb_o2o/inc/mobile/goods_page.inc.php
  83. 10 0
      server/addons/hyb_o2o/inc/mobile/hdsz.inc.php
  84. 121 0
      server/addons/hyb_o2o/inc/mobile/in_business.inc.php
  85. 223 0
      server/addons/hyb_o2o/inc/mobile/index.inc.php
  86. 14 0
      server/addons/hyb_o2o/inc/mobile/jf_jl_detail.inc.php
  87. 10 0
      server/addons/hyb_o2o/inc/mobile/jf_record.inc.php
  88. 10 0
      server/addons/hyb_o2o/inc/mobile/jfsp.inc.php
  89. 18 0
      server/addons/hyb_o2o/inc/mobile/jifen_list.inc.php
  90. 19 0
      server/addons/hyb_o2o/inc/mobile/jifen_record.inc.php
  91. 34 0
      server/addons/hyb_o2o/inc/mobile/jifen_sc.inc.php
  92. 41 0
      server/addons/hyb_o2o/inc/mobile/jifen_sp.inc.php
  93. 236 0
      server/addons/hyb_o2o/inc/mobile/login.inc.php
  94. 9 0
      server/addons/hyb_o2o/inc/mobile/login.php
  95. 382 0
      server/addons/hyb_o2o/inc/mobile/mddd.inc.php
  96. 4 0
      server/addons/hyb_o2o/inc/mobile/member_VIP.inc - ╕▒▒╛ (5).php
  97. 79 0
      server/addons/hyb_o2o/inc/mobile/member_vip.inc.php
  98. 150 0
      server/addons/hyb_o2o/inc/mobile/mine.inc.php
  99. 123 0
      server/addons/hyb_o2o/inc/mobile/mine_s.inc.php
  100. 119 0
      server/addons/hyb_o2o/inc/mobile/mine_s_hy.inc.php

+ 316 - 0
doc/app源码目录.md

xqd
@@ -0,0 +1,316 @@
+服务器请求地址api https://t15.9026.com/app/index.php?i=2&c=entry&do=login&m=hyb_o2o&op=app 
+
+对应 server/addons/hyb_o2o/inc/mobile/login.inc.php
+if ($op == 'app')  这段代码
+
+前端代码路径说明
+
+{
+  "pages": [
+    "hyb_o2o/tablist/index/index",
+    "hyb_o2o/tablist/index2/index",
+    "hyb_o2o/tablist/mine/mine",
+    "hyb_o2o/tablist/store_list/store_list",
+    "hyb_o2o/tablist/all_type/all_type",
+    "hyb_o2o/tablist/faxian/faxian",
+    "hyb_o2o/distribution/yaoqing",
+    "hyb_o2o/distribution/distribution",
+    "hyb_o2o/distribution/fxyj",
+    "hyb_o2o/distribution/symx",
+    "hyb_o2o/distribution/txmx",
+    "hyb_o2o/distribution/wdtd",
+    "hyb_o2o/distribution/bill",
+    "hyb_o2o/map/localtion"
+  ],
+
+
+  "subPackages": [
+    {
+    	//商家 
+      "root": "hyb_o2o/addpages/",
+      "pages": [
+        "pages/cart/cart",
+        "pages/jishilist/jishilist",            //技师列表
+        "pages/jishixiadan/jishixiadan",
+        "pages/jishixq/jishixq",
+        "pages/newproper/newproper",
+        "pages/selvip/selvip",
+        "pages/vipxiangqing/vipxiangqing",
+        "pages/huiyuan/huiyuan",
+        "pages/huiyuan2/huiyuan2",
+        "pages/huiyuantequan/huiyuantequan",
+        "pages/fabu/fabu",
+        "pages/all/all",
+        "pages/mine_s/mine_s",  				//商家主页
+        "pages/mine_y/mine_y",					//员工主页
+        "pages/orders/orders",
+        "pages/s_orders/s_orders",
+        "pages/y_orders/y_orders",
+        "pages/share_goods/share_goods",
+        "pages/share/share",
+        "pages/flag_group/flag_group",
+        "pages/flag_member/flag_member",
+        "pages/amount_water/amount_water",
+        "pages/switchcity/switchcity",
+        "pages/y_order_slider/y_order_slider",
+        "pages/jf_jl_detail/jf_jl_detail",
+        "pages/sp_dd_detail/sp_dd_detail",
+        "pages/buy_vip/buy_vip",
+        "pages/sp_invoice/sp_invoice",
+        "pages/magCard/magCard",
+        "pages/magCard_jl/magCard_jl",
+        "pages/position/position",
+        "pages/wode_js/wode_js",                    //员工我的
+        "pages/order_two_sj/order_two_sj",
+        "pages/store/store",
+        "pages/resume/resume",
+        "pages/resume_edit/resume_edit",
+        "pages/ziwojieshao/ziwojieshao",
+        "pages/real_name/real_name",
+        "pages/handbook/handbook",
+        "pages/zixun/zixun",
+        "pages/zx_pinglun/zx_pinglun",
+        "pages/hiredetail/hiredetail"
+      ]
+    },
+    {
+    	//
+      "root": "hyb_o2o/inner/",
+      "pages": [
+        "pages/ad/ad",
+        "pages/refund/refund",
+        "pages/seeReund/seeReund",
+        "pages/add_editor/add_editor",
+        "pages/add_server_type/add_server_type",
+        "pages/address/address",
+        "pages/apply_distributor/apply_distributor",
+        "pages/detail/detail",
+        "pages/fa_detail/fa_detail",
+        "pages/fb_types/fb_types",
+        "pages/goods_page/goods_page",
+        "pages/hdsz/hdsz",
+        "pages/in_business/in_business",
+        "pages/jf_record/jf_record",
+        "pages/jfsp/jfsp",
+        "pages/jifen_sc/jifen_sc",
+        "pages/mddd/mddd",
+        "pages/nav_list/nav_list",
+        "pages/order_detail/order_detail",
+        "pages/order_status/order_status",
+        "pages/order_status1/order_status1",
+        "pages/fuwuxiangqing/fuwuxiangqing",
+        "pages/yuangonglist/yuangonglist",
+        "pages/order_status2/order_status2",
+        "pages/jifen-serve/jifen-serve",
+        "pages/order_status3/order_status3",
+        "pages/order_status_jb/order_status_jb",
+        "pages/order_detail_jb/order_detail_jb",
+        "pages/state/state"
+      ]
+    },
+    {
+      "root": "hyb_o2o/subpagesA/",
+      "pages": [
+        "pages/ping_done/ping_done",
+        "pages/pingfen/pingfen",
+        "pages/pingfen2/pingfen",
+        "pages/qd_page/qd_page",
+        "pages/qddt/qddt",
+        "pages/qddt_fw/qddt_fw",
+        "pages/question/question",
+        "pages/refill/refill",
+        "pages/refill_detail/refill_detail",
+        "pages/refill_detail2/refill_detail2",
+        "pages/refill_log/refill_log",
+        "pages/sc/sc",
+        "pages/search_list/search_list",
+        "pages/statistics/statistics",
+        "pages/store_page/store_page",
+        "pages/txmx/txmx",
+        "pages/wdfb/wdfb",
+        "pages/wdpj/wdpj",
+        "pages/yglb/yglb",
+        "pages/ygrz/ygrz",
+        "pages/ygrz_look/ygrz_look",
+        "pages/youhui/youhui",
+        "pages/yuyue/yuyue",
+        "pages/yuyue2/yuyue2",
+        "pages/pingfen3/pingfen",
+        "pages/fadanpj/fadanpj",
+        "pages/rzmx/rzmx",
+        "pages/jbdt/jbdt",
+        "pages/jb_detail/jb_detail",
+        "pages/jslb/jslb",
+        "pages/bond/bond",
+        "pages/bondmx/bondmx",
+        "pages/zixun_detail/zixun_detail",
+        "pages/taocanlist/taocanlist",
+        "pages/taocan_xq/taocan_xq"
+      ]
+    },
+    {
+      "root": "hyb_o2o/subpagesB/",
+      "pages": [
+        "pages/business_pages/inner/all_server/all_server",
+        "pages/business_pages/inner/fw_pingjia_d/fw_pingjia_d",
+        "pages/business_pages/inner/hx_order/hx_order",
+        "pages/business_pages/inner/order/order",
+        "pages/business_pages/order/order",
+        "pages/business_pages/inner/pj_list/pj_list",
+        "pages/business_pages/inner/record/record",
+        "pages/business_pages/inner/staff_management/staff_management",
+        "pages/business_pages/inner/statistical/statistical",
+        "pages/business_pages/inner/store_mess/store_mess",
+        "pages/business_pages/inner/withdrawal/withdrawal",
+        "pages/business_pages/inner/add_server/add_server",
+        "pages/distributor_pages/fee_list/fee_list",
+        "pages/distributor_pages/recommend_clients/recommend_clients",
+        "pages/distributor_pages/record/record",
+        "pages/distributor_pages/withdrawal/withdrawal",
+        "pages/distributor_pages/yongjintixian/yongjintixian",
+        "pages/change_info/change_info",
+        "pages/vip_card_mx/vip_card_mx",
+        "pages/distributor_pages/capital_center/capital_center"
+      ]
+    },
+    {
+      "root": "hyb_o2o/qd/",
+      "pages": [
+        "pages/index/index",
+        "pages/service/service",
+        "pages/my_order/my_order",
+        "pages/accept_order/accept_order",
+        "pages/withdrawal/withdrawal",
+        "pages/order_details/order_details",
+        "pages/classified/classified",
+        "pages/release_center/release_center",
+        "pages/waiting_order/waiting_order",
+        "pages/bargain_details/bargain_details",
+        "pages/component/header/header",
+        "pages/oneself_details/oneself_details"
+      ]
+    },
+    {
+     //积分
+      "root": "hyb_o2o/integral/",
+      "pages": [
+        "pages/home/home",
+        "pages/guide/guide",
+        "pages/subject/subject",
+        "pages/week-benefit/week-benefit",
+        "pages/cheaper-detail/cheaper-detail",
+        "pages/scenic-spot/index/index",
+        "pages/scenic-spot/detail/detail",
+        "pages/scenic-spot/booking/booking",
+        "pages/scenic-spot/location/location",
+        "pages/scenic-spot/img-full/img-full",
+        "pages/pintuan/index/index",
+        "pages/pintuan/order-list/order-list",
+        "pages/pintuan/detail/detail",
+        "pages/pintuan/fail/fail",
+        "pages/bargain-take/bargain-take",
+        "pages/minute-lottery/minute-lottery",
+        "pages/exchange-gift/exchange-gift",
+        "pages/index/index",
+        "pages/up/up",
+        "pages/zutr/zutr",
+        "pages/invite/invite",
+        "pages/sports/sports",
+        "pages/exchange-record/exchange-record",
+        "pages/integral-lottery/integral-lottery",
+        "pages/integral-success/integral-success",
+        "pages/lottery-record/lottery-record",
+        "pages/exchange-integral/exchange-integral",
+        "pages/cheaper/cheaper",
+        "pages/search-result/search-result",
+        "pages/mine-record/mine-record",
+        "pages/award-record/award-record",
+        "pages/mine/mine",
+        "pages/get-benefit/get-benefit",
+        "pages/certificate/certificate",
+        "pages/mine-order/mine-order",
+        "pages/minute-lottery1/minute-lottery1",
+        "pages/bargain-take1/bargain-take1",
+        "pages/bargain-rule/bargain-rule",
+        "pages/favorite/favorite",
+        "pages/suggest/suggest",
+        "pages/order-detail/order-detail",
+        "pages/comment/comment",
+        "pages/minute-lottery-detail/minute-lottery-detail",
+        "pages/order-confirm/order-confirm",
+        "pages/add-address/add-address",
+        "pages/minute-lottery-rule/minute-lottery-rule",
+        "pages/bargain-take-detail/bargain-take-detail",
+        "pages/mine-distribute/mine-distribute"
+      ]
+    },
+    {
+    //代理
+      "root": "hyb_o2o/agent/",
+      "pages": [
+        "index",
+        "shoplist",
+        "invite",
+        "mlog",
+        "explain",
+        "get_money",
+        "checkBill",
+        "join"
+      ]
+    },
+    {
+    //分销
+      "root": "hyb_o2o/fenxiao/",
+      "pages": [
+        "order_record",
+        "card_record",
+        "invite_shop"
+      ]
+    },
+    {
+      "root": "hyb_o2o/zofui_sales/",
+      "pages": [
+        "pages/quick/index",
+        "pages/group/index",
+        "pages/cut/list",
+        "pages/act/index",
+        "pages/good/good",
+        "pages/buycard/buycard",
+        "pages/info/info",
+        "pages/rules/rules",
+        "pages/hongbao_detail/hongbao_detail",
+        "pages/libao_detail/libao_detail",
+        "pages/good_qg/good",
+        "pages/order/confirm"
+      ]
+    },
+    {
+    	//社区板块
+      "root": "hyb_o2o/community/",
+      "pages": [
+        "pages/shequ/shequ",
+        "pages/shequ_detail/shequ_detail",
+        "pages/shequ_center/shequ_center",
+        "pages/apply_shequ/apply_shequ",
+        "pages/shequ_yj/shequ_yj",
+        "pages/shequ_txmx/shequ_txmx"
+      ]
+    },
+    {
+      "root": "hyb_o2o/map_home/",
+      "window": {
+        "navigationBarBackgroundColor": "#ffffff",
+        "navigationBarTextStyle": "black",
+        "navigationBarTitleText": "小程序",
+        "backgroundColor": "#eeeeee",
+        "backgroundTextStyle": "light",
+        "enablePullDownRefresh": "0",
+        "navigationStyle": "custom"
+      },
+      "pages": [
+        "pages/map/index"
+      ]
+    }
+  ],
+ 
+}

+ 8 - 0
doc/bug.md

xqd
@@ -0,0 +1,8 @@
+加盟图片
+https://t15.9026.com/app/index.php?i=2&t=0&v=1.0.0&from=wxapp&c=entry&a=wxapp&do=daili&m=hyb_o2o&sign=f75ede90f5f8428d6f49fcb02bebbd80&openid=o185r5dk4axMiZ
+
+加盟页面
+https://t15.9026.com/app/index.php?i=2&t=0&v=1.0.0&from=wxapp&c=entry&a=wxapp&do=daili&m=hyb_o2o&sign=9bb48c8ce1203a6863226c4d1c0b9b8c&openid=o185r5dk4axMiZdSOaBK5V2ORDog&op=ruzhu&name=111&phone=111&password=11&address=%E5%8C%97%E4%BA%AC%E5%B8%82%2C%E5%8C%97%E4%BA%AC%E5%B8%
+
+新闻没有显示
+https://t15.9026.com/app/index.php?i=2&t=0&v=1.0.0&from=wxapp&c=entry&a=wxapp&do=Article_type&m=hyb_o2o&sign=31899f553502f81d639ed13f35d746be&type=js

+ 2 - 0
server/addons/hyb_o2o/.idea/.gitignore

xqd
@@ -0,0 +1,2 @@
+# Default ignored files
+/workspace.xml

+ 2 - 0
server/addons/hyb_o2o/1.txt

xqd
@@ -0,0 +1,2 @@
+1
+//第一行的值,设置为1,后台显示应用商城,设置为0后台不显示应用商城。

+ 8 - 0
server/addons/hyb_o2o/Lib/YLYConfigClient.php

xqd
@@ -0,0 +1,8 @@
+<?php
+//解密QQ:麒擎网络
+class YLYConfigClient
+{
+    static $YLYClientId = "1062809662";
+    static $YLYClientSecret = "467fac12be61a1288d4b016b716f9b4b";
+    static $YLYRequestUrl = "https://open-api.10ss.net";
+}

+ 25 - 0
server/addons/hyb_o2o/Lib/YLYHttpClient.php

xqd
@@ -0,0 +1,25 @@
+<?php
+//解密QQ:麒擎网络
+class YLYHttpClient
+{
+    public static function push($requestInfo, $url)
+    {
+        $curl = curl_init();
+        curl_setopt($curl, CURLOPT_URL, $url);
+        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
+        curl_setopt($curl, CURLOPT_HTTPHEADER, array("Expect:"));
+        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
+        curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
+        curl_setopt($curl, CURLOPT_POST, 1);
+        curl_setopt($curl, CURLOPT_POSTFIELDS, $requestInfo);
+        curl_setopt($curl, CURLOPT_TIMEOUT, 30);
+        curl_setopt($curl, CURLOPT_HEADER, 0);
+        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+        $tmpInfo = curl_exec($curl);
+        if (curl_errno($curl)) {
+            echo "Errno" . curl_error($curl);
+        }
+        curl_close($curl);
+        return $tmpInfo;
+    }
+}

+ 106 - 0
server/addons/hyb_o2o/Lib/YLYOpenApiClient.php

xqd
@@ -0,0 +1,106 @@
+<?php
+//解密QQ:麒擎网络
+require_once IA_ROOT . "/addons/zh_hdbm/Lib/YLYConfigClient.php";
+require_once IA_ROOT . "/addons/zh_hdbm/Lib/YLYSignAndUuidClient.php";
+require_once IA_ROOT . "/addons/zh_hdbm/Lib/YLYHttpClient.php";
+class YLYOpenApiClient
+{
+    public static function addPrint($machineCode, $msign, $accessToken, $timesTamp)
+    {
+        $requestUrl = YLYConfigClient::$YLYRequestUrl . "/printer/addprinter";
+        $requestAll = ["client_id" => YLYConfigClient::$YLYClientId, "sign" => YLYSignAndUuidClient::GetSign($timesTamp), "id" => YLYSignAndUuidClient::Uuid4(), "machine_code" => $machineCode, "msign" => $msign, "access_token" => $accessToken, "timestamp" => $timesTamp];
+        $requestInfo = http_build_query($requestAll);
+        return YLYHttpClient::push($requestInfo, $requestUrl);
+    }
+    public static function printIndex($machineCode, $accessToken, $content, $originId, $timesTamp, $client_id, $clientSecret)
+    {
+        $requestUrl = YLYConfigClient::$YLYRequestUrl . "/print/index";
+        $requestAll = ["client_id" => $client_id, "sign" => YLYSignAndUuidClient::GetSign($timesTamp, $client_id, $clientSecret), "id" => YLYSignAndUuidClient::Uuid4(), "machine_code" => $machineCode, "access_token" => $accessToken, "content" => $content, "origin_id" => $originId, "timestamp" => $timesTamp];
+        $requestInfo = http_build_query($requestAll);
+        return YLYHttpClient::push($requestInfo, $requestUrl);
+    }
+    public static function deletePrint($machineCode, $accessToken, $timesTamp)
+    {
+        $requestUrl = YLYConfigClient::$YLYRequestUrl . "/printer/deleteprinter";
+        $requestAll = ["client_id" => YLYConfigClient::$YLYClientId, "sign" => YLYSignAndUuidClient::GetSign($timesTamp), "id" => YLYSignAndUuidClient::Uuid4(), "machine_code" => $machineCode, "access_token" => $accessToken, "timestamp" => $timesTamp];
+        $requestInfo = http_build_query($requestAll);
+        return YLYHttpClient::push($requestInfo, $requestUrl);
+    }
+    public static function printMenu($machineCode, $accessToken, $content, $timesTamp)
+    {
+        $requestUrl = YLYConfigClient::$YLYRequestUrl . "/printmenu/addprintmenu";
+        $requestAll = ["client_id" => YLYConfigClient::$YLYClientId, "sign" => YLYSignAndUuidClient::GetSign($timesTamp), "id" => YLYSignAndUuidClient::Uuid4(), "machine_code" => $machineCode, "access_token" => $accessToken, "content" => $content, "timestamp" => $timesTamp];
+        $requestInfo = http_build_query($requestAll);
+        return YLYHttpClient::push($requestInfo, $requestUrl);
+    }
+    public static function shutdownRestart($machineCode, $accessToken, $responseType, $timesTamp)
+    {
+        $requestUrl = YLYConfigClient::$YLYRequestUrl . "/printer/shutdownrestart";
+        $requestAll = ["client_id" => YLYConfigClient::$YLYClientId, "sign" => YLYSignAndUuidClient::GetSign($timesTamp), "id" => YLYSignAndUuidClient::Uuid4(), "machine_code" => $machineCode, "access_token" => $accessToken, "response_type" => $responseType, "timestamp" => $timesTamp];
+        $requestInfo = http_build_query($requestAll);
+        return YLYHttpClient::push($requestInfo, $requestUrl);
+    }
+    public static function setSound($machineCode, $accessToken, $responseType, $voice, $timesTamp)
+    {
+        $requestUrl = YLYConfigClient::$YLYRequestUrl . "/printer/setsound";
+        $requestAll = ["client_id" => YLYConfigClient::$YLYClientId, "sign" => YLYSignAndUuidClient::GetSign($timesTamp), "id" => YLYSignAndUuidClient::Uuid4(), "machine_code" => $machineCode, "access_token" => $accessToken, "response_type" => $responseType, "voice" => $voice, "timestamp" => $timesTamp];
+        $requestInfo = http_build_query($requestAll);
+        return YLYHttpClient::push($requestInfo, $requestUrl);
+    }
+    public static function printInfo($machineCode, $accessToken, $timesTamp)
+    {
+        $requestUrl = YLYConfigClient::$YLYRequestUrl . "/printer/printinfo";
+        $requestAll = ["client_id" => YLYConfigClient::$YLYClientId, "sign" => YLYSignAndUuidClient::GetSign($timesTamp), "id" => YLYSignAndUuidClient::Uuid4(), "machine_code" => $machineCode, "access_token" => $accessToken, "timestamp" => $timesTamp];
+        $requestInfo = http_build_query($requestAll);
+        return YLYHttpClient::push($requestInfo, $requestUrl);
+    }
+    public static function getVersion($machineCode, $accessToken, $timesTamp)
+    {
+        $requestUrl = YLYConfigClient::$YLYRequestUrl . "/printer/getversion";
+        $requestAll = ["client_id" => YLYConfigClient::$YLYClientId, "sign" => YLYSignAndUuidClient::GetSign($timesTamp), "id" => YLYSignAndUuidClient::Uuid4(), "machine_code" => $machineCode, "access_token" => $accessToken, "timestamp" => $timesTamp];
+        $requestInfo = http_build_query($requestAll);
+        return YLYHttpClient::push($requestInfo, $requestUrl);
+    }
+    public static function cancelAll($machineCode, $accessToken, $timesTamp)
+    {
+        $requestUrl = YLYConfigClient::$YLYRequestUrl . "/printer/cancelall";
+        $requestAll = ["client_id" => YLYConfigClient::$YLYClientId, "sign" => YLYSignAndUuidClient::GetSign($timesTamp), "id" => YLYSignAndUuidClient::Uuid4(), "machine_code" => $machineCode, "access_token" => $accessToken, "timestamp" => $timesTamp];
+        $requestInfo = http_build_query($requestAll);
+        return YLYHttpClient::push($requestInfo, $requestUrl);
+    }
+    public static function cancelOne($machineCode, $accessToken, $orderId, $timesTamp)
+    {
+        $requestUrl = YLYConfigClient::$YLYRequestUrl . "/printer/cancelone";
+        $requestAll = ["client_id" => YLYConfigClient::$YLYClientId, "sign" => YLYSignAndUuidClient::GetSign($timesTamp), "id" => YLYSignAndUuidClient::Uuid4(), "machine_code" => $machineCode, "access_token" => $accessToken, "order_id" => $orderId, "timestamp" => $timesTamp];
+        $requestInfo = http_build_query($requestAll);
+        return YLYHttpClient::push($requestInfo, $requestUrl);
+    }
+    public static function setIcon($machineCode, $accessToken, $imgUrl, $timesTamp)
+    {
+        $requestUrl = YLYConfigClient::$YLYRequestUrl . "/printer/seticon";
+        $requestAll = ["client_id" => YLYConfigClient::$YLYClientId, "sign" => YLYSignAndUuidClient::GetSign($timesTamp), "id" => YLYSignAndUuidClient::Uuid4(), "machine_code" => $machineCode, "access_token" => $accessToken, "img_url" => $imgUrl, "timestamp" => $timesTamp];
+        $requestInfo = http_build_query($requestAll);
+        return YLYHttpClient::push($requestInfo, $requestUrl);
+    }
+    public static function deleteIcon($machineCode, $accessToken, $timesTamp)
+    {
+        $requestUrl = YLYConfigClient::$YLYRequestUrl . "/printer/deleteicon";
+        $requestAll = ["client_id" => YLYConfigClient::$YLYClientId, "sign" => YLYSignAndUuidClient::GetSign($timesTamp), "id" => YLYSignAndUuidClient::Uuid4(), "machine_code" => $machineCode, "access_token" => $accessToken, "timestamp" => $timesTamp];
+        $requestInfo = http_build_query($requestAll);
+        return YLYHttpClient::push($requestInfo, $requestUrl);
+    }
+    public static function btnPrint($machineCode, $accessToken, $responseType, $timesTamp)
+    {
+        $requestUrl = YLYConfigClient::$YLYRequestUrl . "/printer/btnprint";
+        $requestAll = ["client_id" => YLYConfigClient::$YLYClientId, "sign" => YLYSignAndUuidClient::GetSign($timesTamp), "id" => YLYSignAndUuidClient::Uuid4(), "machine_code" => $machineCode, "access_token" => $accessToken, "response_type" => $responseType, "timestamp" => $timesTamp];
+        $requestInfo = http_build_query($requestAll);
+        return YLYHttpClient::push($requestInfo, $requestUrl);
+    }
+    public static function getOrder($machineCode, $accessToken, $responseType, $timesTamp)
+    {
+        $requestUrl = YLYConfigClient::$YLYRequestUrl . "/printer/getorder";
+        $requestAll = ["client_id" => YLYConfigClient::$YLYClientId, "sign" => YLYSignAndUuidClient::GetSign($timesTamp), "id" => YLYSignAndUuidClient::Uuid4(), "machine_code" => $machineCode, "access_token" => $accessToken, "response_type" => $responseType, "timestamp" => $timesTamp];
+        $requestInfo = http_build_query($requestAll);
+        return YLYHttpClient::push($requestInfo, $requestUrl);
+    }
+}

+ 18 - 0
server/addons/hyb_o2o/Lib/YLYSignAndUuidClient.php

xqd
@@ -0,0 +1,18 @@
+<?php
+//解密QQ:麒擎网络
+require_once IA_ROOT . "/addons/zh_hdbm/Lib/YLYConfigClient.php";
+class YLYSignAndUuidClient
+{
+    public static function GetSign($timestamp, $client_id, $clientSecret)
+    {
+        return md5($client_id . $timestamp . $clientSecret);
+    }
+    public static function Uuid4()
+    {
+        mt_srand((double) microtime() * 10000);
+        $charid = strtolower(md5(uniqid(rand(), true)));
+        $hyphen = "-";
+        $uuidv4 = substr($charid, 0, 8) . $hyphen . substr($charid, 8, 4) . $hyphen . substr($charid, 12, 4) . $hyphen . substr($charid, 16, 4) . $hyphen . substr($charid, 20, 12);
+        return $uuidv4;
+    }
+}

+ 21 - 0
server/addons/hyb_o2o/Lib/YLYTokenClient.php

xqd
@@ -0,0 +1,21 @@
+<?php
+//解密QQ:麒擎网络
+require_once IA_ROOT . "/addons/zh_hdbm/Lib/YLYConfigClient.php";
+require_once IA_ROOT . "/addons/zh_hdbm/Lib/YLYSignAndUuidClient.php";
+require_once IA_ROOT . "/addons/zh_hdbm/Lib/YLYHttpClient.php";
+class YLYTokenClient
+{
+    private static $requestUrl = "https://open-api.10ss.net/oauth/oauth";
+    public static function GetToken($grantType, $scope, $timesTamp, $client_id, $clientSecret, $code = null)
+    {
+        $requestAll = ["client_id" => YLYConfigClient::$YLYClientId, "sign" => YLYSignAndUuidClient::GetSign($timesTamp, $client_id, $clientSecret), "id" => YLYSignAndUuidClient::Uuid4(), "grant_type" => $grantType, "scope" => $scope, "code" => $code, "timestamp" => $timesTamp];
+        $requestInfo = http_build_query($requestAll);
+        return YLYHttpClient::push($requestInfo, self::$requestUrl);
+    }
+    public static function RefreshToken($grantType, $scope, $timesTamp, $RefreshToken)
+    {
+        $requestAll = ["client_id" => YLYConfigClient::$YLYClientId, "sign" => YLYSignAndUuidClient::GetSign($timesTamp), "id" => YLYSignAndUuidClient::Uuid4(), "grant_type" => $grantType, "scope" => $scope, "refresh_token" => $RefreshToken, "timestamp" => $timesTamp];
+        $requestInfo = http_build_query($requestAll);
+        return YLYHttpClient::push($requestInfo, self::$requestUrl);
+    }
+}

+ 13 - 0
server/addons/hyb_o2o/Lib/getTokenDemo.php

xqd
@@ -0,0 +1,13 @@
+<?php
+//解密QQ:麒擎网络
+require_once IA_ROOT . "/addons/zh_hdbm/Lib/YLYTokenClient.php";
+$token = new YLYTokenClient();
+$grantType = "client_credentials";
+$scope = "all";
+$timesTamp = time();
+echo $token->GetToken($grantType, $scope, $timesTamp);
+$grantType = "refresh_token";
+$scope = "all";
+$timesTamp = time();
+$RefreshToken = '';
+echo $token->RefreshToken($grantType, $scope, $timesTamp, $RefreshToken);

+ 20 - 0
server/addons/hyb_o2o/Lib/printDemo.php

xqd
@@ -0,0 +1,20 @@
+<?php
+//瑙e瘑QQ:麒擎网络
+require_once __DIR__ . "/lib/YLYOpenApiClient.php";
+$api = new YLYOpenApiClient();
+$content = '';
+$content .= "<FS><center>8号桌</center></FS>";
+$content .= str_repeat("-", 32);
+$content .= "<FS><table>";
+$content .= "<tr><td>商品</td><td>数量</td><td>价格</td></tr>";
+$content .= "<tr><td>土豆回锅肉</td><td>x1</td><td>¥20</td></tr>";
+$content .= "<tr><td>干煸四季豆</td><td>x1</td><td>¥12</td></tr>";
+$content .= "<tr><td>苦瓜炒蛋</td><td>x1</td><td>¥15</td></tr>";
+$content .= "</table></FS>";
+$content .= str_repeat("-", 32) . "\n";
+$content .= "<FS>金额: 47元</FS>";
+$machineCode = '';
+$accessToken = '';
+$originId = '';
+$timesTamp = time();
+echo $api->printIndex($machineCode, $accessToken, $content, $originId, $timesTamp);

+ 54 - 0
server/addons/hyb_o2o/SmsDemo.php

xqd
@@ -0,0 +1,54 @@
+<?php
+//解密QQ:麒擎网络
+ini_set("display_errors", "on");
+require_once dirname(__DIR__) . "/hyb_o2o/api_sdk/vendor/autoload.php";
+use Aliyun\Core\Config;
+use Aliyun\Core\Profile\DefaultProfile;
+use Aliyun\Core\DefaultAcsClient;
+use Aliyun\Api\Sms\Request\V20170525\SendSmsRequest;
+use Aliyun\Api\Sms\Request\V20170525\QuerySendDetailsRequest;
+Config::load();
+class SmsDemo
+{
+    public function __construct($accessKeyId, $accessKeySecret)
+    {
+        $product = "Dysmsapi";
+        $domain = "dysmsapi.aliyuncs.com";
+        $region = "cn-hangzhou";
+        $endPointName = "cn-hangzhou";
+        $profile = DefaultProfile::getProfile($region, $accessKeyId, $accessKeySecret);
+        DefaultProfile::addEndpoint($endPointName, $region, $product, $domain);
+        $this->acsClient = new DefaultAcsClient($profile);
+    }
+    public function sendSms($signName, $templateCode, $phoneNumbers, $templateParam = null, $outId = null)
+    {
+        $request = new SendSmsRequest();
+        $request->setPhoneNumbers($phoneNumbers);
+        $request->setSignName($signName);
+        $request->setTemplateCode($templateCode);
+        if ($templateParam) {
+            $request->setTemplateParam(json_encode($templateParam));
+        }
+        if ($outId) {
+            $request->setOutId($outId);
+        }
+        $acsResponse = $this->acsClient->getAcsResponse($request);
+        return $acsResponse;
+    }
+    public function queryDetails($phoneNumbers, $sendDate, $pageSize = 10, $currentPage = 1, $bizId = null)
+    {
+        $request = new QuerySendDetailsRequest();
+        $request->setPhoneNumber($phoneNumbers);
+        $request->setBizId($bizId);
+        $request->setSendDate($sendDate);
+        $request->setPageSize($pageSize);
+        $request->setCurrentPage($currentPage);
+        $acsResponse = $this->acsClient->getAcsResponse($request);
+        return $acsResponse;
+    }
+}
+header("Content-Type: text/plain; charset=utf-8");
+$demo = new SmsDemo($user_name, $password);
+$response = $demo->sendSms($signature, $model, $tel);
+echo json_encode($response);
+$response = $demo->queryDetails($tel, "20170718", 10, 1);

+ 100 - 0
server/addons/hyb_o2o/admin/common/attachurl.php

xqd
@@ -0,0 +1,100 @@
+<?php
+
+/**
+ * [WeEngine System] Copyright (c) 2014 WE7.CC
+ * WeEngine is NOT a free software, it under the license terms, visited http://www.efwww.com/ for more details.
+ */
+defined('IN_IA') or exit('Access Denied');
+//load()->web('common');
+//load()->web('template');
+//load()->func('file');
+//load()->func('tpl');
+//load()->model('account');
+//load()->model('setting');
+//load()->model('user');
+//load()->model('permission');
+load()->model('attachment');
+//load()->classs('oauth2/oauth2client');
+$_W['token'] = token();
+/*$session = json_decode(authcode($_GPC['__session']), true);
+
+if (is_array($session)) {
+
+	$user = user_single(array('uid'=>$session['uid']));
+
+	if (is_array($user) && $session['hash'] === md5($user['password'] . $user['salt'])) {
+
+		$_W['uid'] = $user['uid'];
+
+		$_W['username'] = $user['username'];
+
+		$user['currentvisit'] = $user['lastvisit'];
+
+		$user['currentip'] = $user['lastip'];
+
+		$user['lastvisit'] = $session['lastvisit'];
+
+		$user['lastip'] = $session['lastip'];
+
+		$_W['user'] = $user;
+
+		$_W['isfounder'] = user_is_founder($_W['uid']);
+
+		unset($founders);
+
+	} else {
+
+		isetcookie('__session', false, -100);
+
+	}
+
+	unset($user);
+
+}
+
+unset($session);
+
+
+
+if (!empty($_GPC['__uniacid'])) {
+
+	$_W['uniacid'] = intval($_GPC['__uniacid']);
+
+} else {
+
+	$_W['uniacid'] = uni_account_last_switch();
+
+}
+
+
+
+if (!empty($_W['uniacid'])) {
+
+	$_W['uniaccount'] = $_W['account'] = uni_fetch($_W['uniacid']);
+
+	if (empty($_W['account'])) {
+
+		unset($_W['uniacid']);
+
+	}
+
+	$_W['acid'] = $_W['account']['acid'];
+
+	$_W['weid'] = $_W['uniacid'];
+
+}
+
+
+
+if (!empty($_W['uid'])) {
+
+	$_W['highest_role'] = permission_account_user_role($_W['uid']);
+
+	$_W['role'] = permission_account_user_role($_W['uid'], $_W['uniacid']);
+
+}
+
+$_W['template'] = !empty($_W['setting']['basic']['template']) ? $_W['setting']['basic']['template'] : 'default';
+*/
+$_W['attachurl'] = attachment_set_attach_url();
+//load()->func('compat.biz');

+ 273 - 0
server/addons/hyb_o2o/admin/common/bootstrap.sys.inc.php

xqd
@@ -0,0 +1,273 @@
+<?php
+
+/**
+ * [WeEngine System] Copyright (c) 2014 WE7.CC
+ * WeEngine is NOT a free software, it under the license terms, visited http://www.efwww.com/ for more details.
+ */
+load()->model('user');
+load()->func('tpl');
+if (file_exists(IA_ROOT . '/framework/model/permission.mod.php')) {
+    load()->model('permission');
+} else {
+    function permission_build()
+    {
+        global $_W;
+        $we7_file_permission = (require IA_ROOT . '/web/common/permission.inc.php');
+        $permission_frames = (require IA_ROOT . '/web/common/frames.inc.php');
+        if (!in_array($_W['role'], array(ACCOUNT_MANAGE_NAME_OPERATOR, ACCOUNT_MANAGE_NAME_MANAGER)) || empty($_W['uniacid'])) {
+            return $we7_file_permission;
+        }
+        $cachekey = cache_system_key("permission:{$_W['uniacid']}:{$_W['uid']}");
+        $cache = cache_load($cachekey);
+        if (!empty($cache)) {
+            return $cache;
+        }
+        $permission_exist = permission_account_user_permission_exist($_W['uid'], $_W['uniacid']);
+        if (empty($permission_exist)) {
+            $we7_file_permission['platform'][$_W['role']] = array('platform*');
+            $we7_file_permission['site'][$_W['role']] = array('site*');
+            $we7_file_permission['mc'][$_W['role']] = array('mc*');
+            $we7_file_permission['profile'][$_W['role']] = array('profile*');
+            $we7_file_permission['module'][$_W['role']] = array('manage-account', 'display');
+            $we7_file_permission['wxapp'][$_W['role']] = array('display', 'payment', 'post', 'version');
+            cache_write($cachekey, $we7_file_permission);
+            return $we7_file_permission;
+        }
+        $user_account_permission = permission_account_user_menu($_W['uid'], $_W['uniacid'], PERMISSION_ACCOUNT);
+        $user_wxapp_permission = permission_account_user_menu($_W['uid'], $_W['uniacid'], PERMISSION_WXAPP);
+        $user_permission = array_merge($user_account_permission, $user_wxapp_permission);
+        $permission_contain = array('account', 'wxapp', 'system');
+        $section = array();
+        $permission_result = array();
+        foreach ($permission_frames as $key => $frames) {
+            if (!in_array($key, $permission_contain) || empty($frames['section'])) {
+                continue;
+            }
+            foreach ($frames['section'] as $frame_key => $frame) {
+                if (empty($frame['menu'])) {
+                    continue;
+                }
+                $section[$key][$frame_key] = $frame['menu'];
+            }
+        }
+        $account = permission_get_nameandurl($section[$permission_contain[0]]);
+        $wxapp = permission_get_nameandurl($section[$permission_contain[1]]);
+        $system = permission_get_nameandurl($section[$permission_contain[2]]);
+        $permission_result = array_merge($account, $wxapp, $system);
+        foreach ($permission_result as $permission_val) {
+            if (in_array($permission_val['permission_name'], $user_permission)) {
+                $we7_file_permission[$permission_val['controller']][$_W['role']][] = $permission_val['action'];
+            }
+        }
+        cache_write($cachekey, $we7_file_permission);
+        return $we7_file_permission;
+    }
+    function permission_account_user_role($uid = 0, $uniacid = 0)
+    {
+        global $_W;
+        load()->model('user');
+        $role = '';
+        $uid = empty($uid) ? $_W['uid'] : intval($uid);
+        if (user_is_founder($uid) && !user_is_vice_founder($uid)) {
+            return ACCOUNT_MANAGE_NAME_FOUNDER;
+        }
+        if (user_is_vice_founder($uid)) {
+            return ACCOUNT_MANAGE_NAME_VICE_FOUNDER;
+        }
+        if (!empty($uniacid)) {
+            $role = pdo_getcolumn('uni_account_users', array('uid' => $uid, 'uniacid' => $uniacid), 'role');
+            if ($role == ACCOUNT_MANAGE_NAME_OWNER) {
+                $role = ACCOUNT_MANAGE_NAME_OWNER;
+            } elseif ($role == ACCOUNT_MANAGE_NAME_VICE_FOUNDER) {
+                $role = ACCOUNT_MANAGE_NAME_VICE_FOUNDER;
+            } elseif ($role == ACCOUNT_MANAGE_NAME_MANAGER) {
+                $role = ACCOUNT_MANAGE_NAME_MANAGER;
+            } elseif ($role == ACCOUNT_MANAGE_NAME_OPERATOR) {
+                $role = ACCOUNT_MANAGE_NAME_OPERATOR;
+            } elseif ($role == ACCOUNT_MANAGE_NAME_CLERK) {
+                $role = ACCOUNT_MANAGE_NAME_CLERK;
+            }
+        } else {
+            $roles = pdo_getall('uni_account_users', array('uid' => $uid), array('role'), 'role');
+            $roles = array_keys($roles);
+            if (in_array(ACCOUNT_MANAGE_NAME_VICE_FOUNDER, $roles)) {
+                $role = ACCOUNT_MANAGE_NAME_VICE_FOUNDER;
+            } elseif (in_array(ACCOUNT_MANAGE_NAME_OWNER, $roles)) {
+                $role = ACCOUNT_MANAGE_NAME_OWNER;
+            } elseif (in_array(ACCOUNT_MANAGE_NAME_MANAGER, $roles)) {
+                $role = ACCOUNT_MANAGE_NAME_MANAGER;
+            } elseif (in_array(ACCOUNT_MANAGE_NAME_OPERATOR, $roles)) {
+                $role = ACCOUNT_MANAGE_NAME_OPERATOR;
+            } elseif (in_array(ACCOUNT_MANAGE_NAME_CLERK, $roles)) {
+                $role = ACCOUNT_MANAGE_NAME_CLERK;
+            }
+        }
+        $role = empty($role) ? ACCOUNT_MANAGE_NAME_OPERATOR : $role;
+        return $role;
+    }
+    function permission_account_user_permission_exist($uid = 0, $uniacid = 0)
+    {
+        global $_W;
+        load()->model('user');
+        $uid = intval($uid) > 0 ? $uid : $_W['uid'];
+        $uniacid = intval($uniacid) > 0 ? $uniacid : $_W['uniacid'];
+        if (user_is_founder($uid)) {
+            return false;
+        }
+        if (FRAME == 'system') {
+            return true;
+        }
+        $is_exist = pdo_get('users_permission', array('uid' => $uid, 'uniacid' => $uniacid), array('id'));
+        if (empty($is_exist)) {
+            return false;
+        } else {
+            return true;
+        }
+    }
+    function permission_account_user($type = 'system')
+    {
+        global $_W;
+        $user_permission = pdo_getcolumn('users_permission', array('uid' => $_W['uid'], 'uniacid' => $_W['uniacid'], 'type' => $type), 'permission');
+        if (!empty($user_permission)) {
+            $user_permission = explode('|', $user_permission);
+        } else {
+            $user_permission = array('account*', 'wxapp*');
+        }
+        $permission_append = frames_menu_append();
+        if (!empty($permission_append[$_W['role']])) {
+            $user_permission = array_merge($user_permission, $permission_append[$_W['role']]);
+        }
+        if (empty($_W['role']) && empty($_W['uniacid'])) {
+            $user_permission = array_merge($user_permission, $permission_append['operator']);
+        }
+        return (array) $user_permission;
+    }
+    function permission_account_user_menu($uid, $uniacid, $type)
+    {
+        $user_menu_permission = array();
+        $uid = intval($uid);
+        $uniacid = intval($uniacid);
+        $type = trim($type);
+        if (empty($uid) || empty($uniacid) || empty($type)) {
+            return error(-1, '参数错误!');
+        }
+        $permission_exist = permission_account_user_permission_exist($uid, $uniacid);
+        if (empty($permission_exist)) {
+            return array('all');
+        }
+        if ($type == 'modules') {
+            $user_menu_permission = pdo_fetchall("SELECT * FROM " . tablename('users_permission') . " WHERE uniacid = :uniacid AND uid  = :uid AND type != '" . PERMISSION_ACCOUNT . "' AND type != '" . PERMISSION_WXAPP . "'", array(':uniacid' => $uniacid, ':uid' => $uid), 'type');
+        } else {
+            $module = uni_modules_by_uniacid($uniacid);
+            $module = array_keys($module);
+            if (in_array($type, $module) || in_array($type, array(PERMISSION_ACCOUNT, PERMISSION_WXAPP, PERMISSION_SYSTEM))) {
+                $menu_permission = pdo_getcolumn('users_permission', array('uniacid' => $uniacid, 'uid' => $uid, 'type' => $type), 'permission');
+                if (!empty($menu_permission)) {
+                    $user_menu_permission = explode('|', $menu_permission);
+                }
+            }
+        }
+        return $user_menu_permission;
+    }
+    function permission_menu_name()
+    {
+        load()->model('system');
+        $menu_permission = array();
+        $menu_list = system_menu_permission_list();
+        $middle_menu = array();
+        $middle_sub_menu = array();
+        if (!empty($menu_list)) {
+            foreach ($menu_list as $nav_id => $section) {
+                foreach ($section['section'] as $section_id => $section) {
+                    if (!empty($section['menu'])) {
+                        $middle_menu[] = $section['menu'];
+                    }
+                }
+            }
+        }
+        if (!empty($middle_menu)) {
+            foreach ($middle_menu as $menu) {
+                foreach ($menu as $menu_val) {
+                    $menu_permission[] = $menu_val['permission_name'];
+                    if (!empty($menu_val['sub_permission'])) {
+                        $middle_sub_menu[] = $menu_val['sub_permission'];
+                    }
+                }
+            }
+        }
+        if (!empty($middle_sub_menu)) {
+            foreach ($middle_sub_menu as $sub_menu) {
+                foreach ($sub_menu as $sub_menu_val) {
+                    $menu_permission[] = $sub_menu_val['permission_name'];
+                }
+            }
+        }
+        return $menu_permission;
+    }
+}
+function uni_permission_o2o($uid = 0, $uniacid = 0)
+{
+    global $_W;
+    $role = '';
+    $uid = empty($uid) ? $_W['uid'] : intval($uid);
+    $founders = explode(',', $_W['config']['setting']['founder']);
+    if (in_array($uid, $founders)) {
+        return ACCOUNT_MANAGE_NAME_FOUNDER;
+    }
+    if (!empty($uniacid)) {
+        $role = pdo_getcolumn('uni_account_users', array('uid' => $uid, 'uniacid' => $uniacid), 'role');
+        if ($role == ACCOUNT_MANAGE_NAME_OWNER) {
+            $role = ACCOUNT_MANAGE_NAME_OWNER;
+        } elseif ($role == ACCOUNT_MANAGE_NAME_MANAGER) {
+            $role = ACCOUNT_MANAGE_NAME_MANAGER;
+        } elseif ($role == ACCOUNT_MANAGE_NAME_OPERATOR) {
+            $role = ACCOUNT_MANAGE_NAME_OPERATOR;
+        }
+    } else {
+        $roles = pdo_getall('uni_account_users', array('uid' => $uid), array('role'), 'role');
+        $roles = array_keys($roles);
+        if (in_array(ACCOUNT_MANAGE_NAME_OWNER, $roles)) {
+            $role = ACCOUNT_MANAGE_NAME_OWNER;
+        } elseif (in_array(ACCOUNT_MANAGE_NAME_MANAGER, $roles)) {
+            $role = ACCOUNT_MANAGE_NAME_MANAGER;
+        } elseif (in_array(ACCOUNT_MANAGE_NAME_OPERATOR, $roles)) {
+            $role = ACCOUNT_MANAGE_NAME_OPERATOR;
+        }
+    }
+    return $role;
+}
+$_W['token'] = token();
+$session = json_decode(base64_decode($_GPC['__session']), true);
+if (is_array($session)) {
+    $user = user_single(array('uid' => $session['uid']));
+    if (is_array($user) && $session['hash'] == md5($user['password'] . $user['salt'])) {
+        $_W['uid'] = $user['uid'];
+        $_W['username'] = $user['username'];
+        $user['currentvisit'] = $user['lastvisit'];
+        $user['currentip'] = $user['lastip'];
+        $user['lastvisit'] = $session['lastvisit'];
+        $user['lastip'] = $session['lastip'];
+        $_W['user'] = $user;
+        $founders = explode(',', $_W['config']['setting']['founder']);
+        $_W['isfounder'] = in_array($_W['uid'], $founders);
+        unset($founders);
+    } else {
+        isetcookie('__session', false, -100);
+    }
+    unset($user);
+}
+unset($session);
+if (!empty($_GPC['__uniacid'])) {
+    $_W['uniacid'] = intval($_GPC['__uniacid']);
+    $_W['uniaccount'] = $_W['account'] = uni_fetch($_W['uniacid']);
+    $_W['acid'] = $_W['account']['acid'];
+    $_W['weid'] = $_W['uniacid'];
+    if (!empty($_W['uid'])) {
+        $_W['role'] = uni_permission($_W['uid'], $_W['uniacid']);
+    }
+}
+$_W['template'] = 'default';
+if (!empty($_W['setting']['basic']['template'])) {
+    $_W['template'] = $_W['setting']['basic']['template'];
+}
+load()->func('compat.biz');

+ 330 - 0
server/addons/hyb_o2o/admin/common/common.func.php

xqd
@@ -0,0 +1,330 @@
+<?php
+
+/**
+ * [WeEngine System] Copyright (c) 2014 WE7.CC
+ * WeEngine is NOT a free software, it under the license terms, visited http://www.efwww.com/ for more details.
+ */
+defined('IN_IA') or exit('Access Denied');
+function url($segment, $params = array())
+{
+    list($controller, $action, $do) = explode('/', $segment);
+    $url = './o2ostore.php?';
+    if (!empty($controller)) {
+        $url .= "c={$controller}&";
+    }
+    if (!empty($action)) {
+        $url .= "a={$action}&";
+    }
+    if (!empty($do)) {
+        $url .= "do={$do}&";
+    }
+    if (!empty($params)) {
+        $queryString = http_build_query($params, '', '&');
+        $url .= $queryString;
+    }
+    //echo $url;die;
+    return $url;
+    //	return wurl($segment, $params);
+}
+function message($msg, $redirect = '', $type = '')
+{
+    global $_W, $_GPC;
+    if ($redirect == 'refresh') {
+        $redirect = $_W['script_name'] . '?' . $_SERVER['QUERY_STRING'];
+    }
+    if ($redirect == 'referer') {
+        $redirect = referer();
+    }
+    if ($redirect == '') {
+        $type = in_array($type, array('success', 'error', 'info', 'warning', 'ajax', 'sql')) ? $type : 'info';
+    } else {
+        $type = in_array($type, array('success', 'error', 'info', 'warning', 'ajax', 'sql')) ? $type : 'success';
+    }
+    if ($_W['isajax'] || !empty($_GET['isajax']) || $type == 'ajax') {
+        if ($type != 'ajax' && !empty($_GPC['target'])) {
+            exit("\n<script type=\"text/javascript\">\nparent.require(['jquery', 'util'], function(\$, util){\n\tvar url = " . (!empty($redirect) ? 'parent.location.href' : "''") . ";\n\tvar modalobj = util.message('" . $msg . "', '', '" . $type . "');\n\tif (url) {\n\t\tmodalobj.on('hide.bs.modal', function(){\$('.modal').each(function(){if(\$(this).attr('id') != 'modal-message') {\$(this).modal('hide');}});top.location.reload()});\n\t}\n});\n</script>");
+        } else {
+            $vars = array();
+            $vars['message'] = $msg;
+            $vars['redirect'] = $redirect;
+            $vars['type'] = $type;
+            exit(json_encode($vars));
+        }
+    }
+    if (empty($msg) && !empty($redirect)) {
+        header('location: ' . $redirect);
+    }
+    $label = $type;
+    if ($type == 'error') {
+        $label = 'danger';
+    }
+    if ($type == 'ajax' || $type == 'sql') {
+        $label = 'warning';
+    }
+    include template('common/message', TEMPLATE_INCLUDEPATH);
+    exit;
+}
+// function checklogin() {
+// 	global $_W;
+// 	if (empty($_W['uid'])) {
+// 		$url = url('user/login');
+// 		header('location:' . $url);
+// 	} else {
+// 		$account = pdo_fetch("SELECT * FROM " . tablename("wpdc_account") . " WHERE status=2 AND uid=:uid ORDER BY id DESC LIMIT 1", array(':uid' => $_W['uid']));
+// 		if (empty($account)) {
+// 			$url = url('user/login');
+// 			header('location:' . $url);
+// 		}
+// 	}
+// 	return true;
+// }
+function checkaccount()
+{
+    global $_W;
+    if (empty($_W['uniacid'])) {
+        message('这项功能需要你选择特定公众号才能使用!', url('account/display'), 'info');
+    }
+}
+function url_params($url)
+{
+    $result = array();
+    if (empty($url)) {
+        return $result;
+    }
+    $components = parse_url($url);
+    $params = explode('&', $components['query']);
+    foreach ($params as $param) {
+        if (!empty($param)) {
+            $param_array = explode('=', $param);
+            $result[$param_array[0]] = $param_array[1];
+        }
+    }
+    return $result;
+}
+function buildframes($frame = array('platform'))
+{
+    global $_W, $_GPC;
+    if ($_W['role'] == 'clerk') {
+        return false;
+    }
+    $GLOBALS['top_nav'] = pdo_fetchall('SELECT name, title, append_title FROM ' . tablename('core_menu') . ' WHERE pid = 0 AND is_display = 1 ORDER BY displayorder DESC');
+    $ms = cache_load('system_frame');
+    if (empty($ms)) {
+        cache_build_frame_menu();
+        $ms = cache_load('system_frame');
+    }
+    load()->model('module');
+    $frames = array();
+    $modules = uni_modules(false);
+    $modules_temp = array_keys($modules);
+    $status = uni_user_permission_exist();
+    if (is_error($status)) {
+        $modules_temp = pdo_fetchall('SELECT type FROM ' . tablename('users_permission') . ' WHERE uniacid = :uniacid AND uid = :uid AND type != :type', array(':uniacid' => $_W['uniacid'], ':uid' => $_W['uid'], ':type' => 'system'), 'type');
+        if (!empty($modules_temp)) {
+            $modules_temp = array_keys($modules_temp);
+        } else {
+            $modules = array();
+        }
+    }
+    if (!empty($modules)) {
+        $sysmods = system_modules();
+        foreach ($modules as $m) {
+            if (empty($m['isdisplay'])) {
+                continue;
+            }
+            if (in_array($m['name'], $sysmods)) {
+                $_W['setting']['permurls']['modules'][] = $m['name'];
+                continue;
+            }
+            if (in_array($m['name'], $modules_temp)) {
+                if ($m['enabled']) {
+                    $frames[$m['type']][] = $m;
+                }
+                $_W['setting']['permurls']['modules'][] = $m['name'];
+            }
+        }
+    }
+    if (is_error($status)) {
+        $system = array();
+        $system = uni_user_permission('system');
+        if (!empty($system) || !empty($modules_temp)) {
+            foreach ($ms as $name => $section) {
+                $hassection = false;
+                foreach ($section as $i => $menus) {
+                    $hasitems = false;
+                    if (empty($menus['items'])) {
+                        continue;
+                    }
+                    foreach ($menus['items'] as $j => $menu) {
+                        if (!in_array($menu['permission_name'], $system)) {
+                            unset($ms[$name][$i]['items'][$j]);
+                        } else {
+                            $hasitems = true;
+                            $hassection = true;
+                        }
+                    }
+                    if (!$hasitems) {
+                        unset($ms[$name][$i]);
+                    }
+                }
+                if (!$hassection) {
+                    unset($ms[$name]);
+                } else {
+                    $_W['setting']['permurls']['sections'][] = $name;
+                }
+            }
+        }
+    }
+    $types = module_types();
+    if (!empty($frames)) {
+        foreach ($frames as $type => $fs) {
+            $items = array();
+            if (!empty($fs)) {
+                foreach ($fs as $m) {
+                    $items[] = array('title' => $m['title'], 'url' => url('home/welcome/ext', array('m' => $m['name'])));
+                }
+            }
+            $ms['ext'][] = array('title' => $types[$type]['title'], 'items' => $items);
+        }
+        if (is_error($status)) {
+            $_W['setting']['permurls']['sections'][] = 'ext';
+        }
+    }
+    $GLOBALS['ext_type'] = 0;
+    $m = trim($_GPC['m']);
+    $eid = intval($_GPC['eid']);
+    if (FRAME == 'ext' && (!empty($m) || !empty($eid)) && $GLOBALS['ext_type'] != 2) {
+        if (empty($_COOKIE['ext_type'])) {
+            setcookie('ext_type', 1, TIMESTAMP + 8640000, "/");
+            $_COOKIE['ext_type'] = 1;
+        }
+        $GLOBALS['ext_type'] = $_COOKIE['ext_type'];
+        if (empty($m)) {
+            $m = pdo_fetchcolumn('SELECT module FROM ' . tablename('modules_bindings') . ' WHERE eid = :eid', array(':eid' => $eid));
+        }
+        $module = module_fetch($m);
+        $entries = module_entries($m);
+        if (is_error($status)) {
+            $permission = uni_user_permission($m);
+            if ($permission[0] != 'all') {
+                if (!in_array($m . '_rule', $permission)) {
+                    unset($module['isrulefields']);
+                }
+                if (!in_array($m . '_settings', $permission)) {
+                    unset($module['settings']);
+                }
+                if (!in_array($m . '_home', $permission)) {
+                    unset($entries['home']);
+                }
+                if (!in_array($m . '_profile', $permission)) {
+                    unset($entries['profile']);
+                }
+                if (!in_array($m . '_shortcut', $permission)) {
+                    unset($entries['shortcut']);
+                }
+                if (!empty($entries['cover'])) {
+                    foreach ($entries['cover'] as $k => $row) {
+                        if (!in_array($m . '_cover_' . $row['do'], $permission)) {
+                            unset($entries['cover'][$k]);
+                        }
+                    }
+                }
+                if (!empty($entries['menu'])) {
+                    foreach ($entries['menu'] as $k => $row) {
+                        if (!in_array($m . '_menu_' . $row['do'], $permission)) {
+                            unset($entries['menu'][$k]);
+                        }
+                    }
+                }
+            }
+        }
+        $entries_filter = array_elements(array('cover', 'menu', 'mine'), $entries);
+        $navs = array(array('title' => "模块列表", 'items' => array(array('title' => "<i class='fa fa-reply-all'></i> &nbsp;&nbsp;返回模块列表", 'url' => url('home/welcome/ext', array('a' => 0))), array('title' => "<i class='fa fa-reply-all'></i> &nbsp;&nbsp;返回{$module['title']}", 'url' => url('home/welcome/ext', array('m' => $m, 't' => 1))))));
+        if ($module['isrulefields'] || $module['settings']) {
+            $navs['rule'] = array('title' => "回复规则");
+            if ($module['isrulefields']) {
+                $navs['rule']['items'][] = array('title' => "<i class='fa fa-comments'></i> &nbsp;&nbsp;回复规则列表", 'url' => url('platform/reply', array('m' => $m)));
+            }
+            if ($module['settings']) {
+                $navs['rule']['items'][] = array('title' => "<i class='fa fa-cog'></i> &nbsp;&nbsp;参数设置", 'url' => url('profile/module/setting', array('m' => $m)));
+            }
+        }
+        if ($entries['home'] || $entries['profile'] || $entries['shortcut']) {
+            $navs['nav'] = array('title' => "导航菜单");
+            if ($entries['home']) {
+                $navs['nav']['items'][] = array('title' => "<i class='fa fa-home'></i> &nbsp;&nbsp;微站首页导航", 'url' => url('site/nav/home', array('m' => $m)));
+            }
+            if ($entries['profile']) {
+                $navs['nav']['items'][] = array('title' => "<i class='fa fa-user'></i> &nbsp;&nbsp;个人中心导航", 'url' => url('site/nav/profile', array('m' => $m)));
+            }
+            if ($entries['shortcut']) {
+                $navs['nav']['items'][] = array('title' => "<i class='fa fa-plane'></i> &nbsp;&nbsp;快捷菜单", 'url' => url('site/nav/shortcut', array('m' => $m)));
+            }
+        }
+        $menus = array('menu' => "业务菜单", 'cover' => "封面入口", 'mine' => "自定义菜单");
+        foreach ($entries_filter as $key => $row) {
+            if (empty($row)) {
+                continue;
+            }
+            if (!isset($navs[$key])) {
+                $navs[$key] = array('title' => $menus[$key]);
+            }
+            foreach ($row as $li) {
+                $navs[$key]['items'][] = array('title' => "<i class='{$li["icon"]}'></i> &nbsp;&nbsp;{$li['title']}", 'url' => $li['url']);
+            }
+        }
+    }
+    if ($GLOBALS['ext_type'] == 1) {
+        $ms['ext'] = $navs;
+    } elseif ($GLOBALS['ext_type'] == 3) {
+        $ms['ext'] = array_merge($navs, $ms['ext']);
+    }
+    return $ms;
+}
+function system_modules()
+{
+    return array('basic', 'news', 'music', 'userapi', 'recharge', 'custom', 'images', 'video', 'voice', 'chats', 'wxcard', 'paycenter');
+}
+function filter_url($params)
+{
+    global $_W;
+    if (empty($params)) {
+        return '';
+    }
+    $query_arr = array();
+    $parse = parse_url($_W['siteurl']);
+    if (!empty($parse['query'])) {
+        $query = $parse['query'];
+        parse_str($query, $query_arr);
+    }
+    $params = explode(',', $params);
+    foreach ($params as $val) {
+        if (!empty($val)) {
+            $data = explode(':', $val);
+            $query_arr[$data[0]] = trim($data[1]);
+        }
+    }
+    $query_arr['page'] = 1;
+    $query = http_build_query($query_arr);
+    return './index.php?' . $query;
+}
+function site_profile_perfect_tips()
+{
+    global $_W;
+    if ($_W['isfounder'] && (empty($_W['setting']['site']) || empty($_W['setting']['site']['profile_perfect']))) {
+        if (!defined('SITE_PROFILE_PERFECT_TIPS')) {
+            $url = url('cloud/profile');
+            return <<<EOF
+\$(function() {
+\tvar html = 
+\t\t'<div id="siteinfo-tips" class="upgrade-tips">'+
+\t\t\t'<a href="{$url}" target="_blank">请尽快完善您在微擎云服务平台的站点注册信息。</a>'+
+\t\t'</div>';
+\t\$('body').prepend(html);
+});
+EOF;
+            define('SITE_PROFILE_PERFECT_TIPS', true);
+        }
+    }
+    return '';
+}

+ 85 - 0
server/addons/hyb_o2o/admin/common/template.func.php

xqd
@@ -0,0 +1,85 @@
+<?php
+
+/**
+ * [WeEngine System] Copyright (c) 2014 WE7.CC
+ * WeEngine is NOT a free software, it under the license terms, visited http://www.efwww.com/ for more details.
+ */
+defined('IN_IA') or exit('Access Denied');
+function template($filename, $flag = TEMPLATE_DISPLAY)
+{
+    global $_W;
+    $source = IA_ROOT . "/addons/hyb_o2o/admin/themes/default/{$filename}.html";
+    $compile = IA_ROOT . "/data/tpl/web/hyb_o2o/default/{$filename}.tpl.php";
+    if (!is_file($source)) {
+        exit("Error: template source '{$filename}' is not exist!");
+    }
+    if (DEVELOPMENT || !is_file($compile) || filemtime($source) > filemtime($compile)) {
+        template_compile($source, $compile);
+    }
+    switch ($flag) {
+        case TEMPLATE_DISPLAY:
+        default:
+            extract($GLOBALS, EXTR_SKIP);
+            include $compile;
+            break;
+        case TEMPLATE_FETCH:
+            extract($GLOBALS, EXTR_SKIP);
+            ob_flush();
+            ob_clean();
+            ob_start();
+            include $compile;
+            $contents = ob_get_contents();
+            ob_clean();
+            return $contents;
+            break;
+        case TEMPLATE_INCLUDEPATH:
+            return $compile;
+            break;
+    }
+}
+function template_compile($from, $to, $inmodule = false)
+{
+    $path = dirname($to);
+    if (!is_dir($path)) {
+        load()->func('file');
+        mkdirs($path);
+    }
+    $content = template_parse(file_get_contents($from), $inmodule);
+    if (IMS_FAMILY == 'x' && !preg_match('/(footer|header|account\\/welcome|login|register)+/', $from)) {
+        $content = str_replace('餐饮', '系统', $content);
+    }
+    file_put_contents($to, $content);
+}
+function template_parse($str, $inmodule = false)
+{
+    $str = preg_replace('/<!--{(.+?)}-->/s', '{$1}', $str);
+    $str = preg_replace('/{template\\s+(.+?)}/', '<?php (!empty($this) && $this instanceof WeModuleSite || ' . intval($inmodule) . ') ? (include $this->template($1, TEMPLATE_INCLUDEPATH)) : (include template($1, TEMPLATE_INCLUDEPATH));?>', $str);
+    $str = preg_replace('/{php\\s+(.+?)}/', '<?php $1?>', $str);
+    $str = preg_replace('/{if\\s+(.+?)}/', '<?php if($1) { ?>', $str);
+    $str = preg_replace('/{else}/', '<?php } else { ?>', $str);
+    $str = preg_replace('/{else ?if\\s+(.+?)}/', '<?php } else if($1) { ?>', $str);
+    $str = preg_replace('/{\\/if}/', '<?php } ?>', $str);
+    $str = preg_replace('/{loop\\s+(\\S+)\\s+(\\S+)}/', '<?php if(is_array($1)) { foreach($1 as $2) { ?>', $str);
+    $str = preg_replace('/{loop\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)}/', '<?php if(is_array($1)) { foreach($1 as $2 => $3) { ?>', $str);
+    $str = preg_replace('/{\\/loop}/', '<?php } } ?>', $str);
+    $str = preg_replace('/{(\\$[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)}/', '<?php echo $1;?>', $str);
+    $str = preg_replace('/{(\\$[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff\\[\\]\'\\"\\$]*)}/', '<?php echo $1;?>', $str);
+    $str = preg_replace('/{url\\s+(\\S+)}/', '<?php echo url($1);?>', $str);
+    $str = preg_replace('/{url\\s+(\\S+)\\s+(array\\(.+?\\))}/', '<?php echo url($1, $2);?>', $str);
+    $str = preg_replace('/{media\\s+(\\S+)}/', '<?php echo tomedia($1);?>', $str);
+    $str = preg_replace_callback('/<\\?php([^\\?]+)\\?>/s', "template_addquote", $str);
+    $str = preg_replace('/{([A-Z_\\x7f-\\xff][A-Z0-9_\\x7f-\\xff]*)}/s', '<?php echo $1;?>', $str);
+    $str = str_replace('{##', '{', $str);
+    $str = str_replace('##}', '}', $str);
+    if (!empty($GLOBALS['_W']['setting']['remote']['type'])) {
+        $str = str_replace('</body>', "<script>\$(function(){\$('img').attr('onerror', '').on('error', function(){if (!\$(this).data('check-src') && (this.src.indexOf('http://') > -1 || this.src.indexOf('https://') > -1)) {this.src = this.src.indexOf('{$GLOBALS['_W']['attachurl_local']}') == -1 ? this.src.replace('{$GLOBALS['_W']['attachurl_remote']}', '{$GLOBALS['_W']['attachurl_local']}') : this.src.replace('{$GLOBALS['_W']['attachurl_local']}', '{$GLOBALS['_W']['attachurl_remote']}');\$(this).data('check-src', true);}});});</script></body>", $str);
+    }
+    $str = "<?php defined('IN_IA') or exit('Access Denied');?>" . $str;
+    return $str;
+}
+function template_addquote($matchs)
+{
+    $code = "<?php {$matchs[1]}?>";
+    $code = preg_replace('/\\[([a-zA-Z0-9_\\-\\.\\x7f-\\xff]+)\\](?![a-zA-Z0-9_\\-\\.\\x7f-\\xff\\[\\]]*[\'"])/s', "['\$1']", $code);
+    return str_replace('\\\\"', '\\"', $code);
+}

+ 144 - 0
server/addons/hyb_o2o/admin/index.php

xqd
@@ -0,0 +1,144 @@
+<?php
+
+define('IN_SYS', true);
+define('IN_dianc_ADMIN', true);
+require '../../../framework/bootstrap.inc.php';
+//require IA_ROOT . '/web/common/bootstrap.sys.inc.php';
+define('dianc_ROOT', dirname(dirname(__FILE__)));
+define('IS_OPERATOR', true);
+require dianc_ROOT . '/admin/common/bootstrap.sys.inc.php';
+require dianc_ROOT . '/admin/common/template.func.php';
+require dianc_ROOT . '/admin/common/common.func.php';
+$urls = parse_url($_W['siteroot']);
+$arr = explode('/', $urls['path']);
+do {
+    $val = array_pop($arr);
+} while ($val != 'addons');
+$path = implode('/', $arr);
+if (substr($path, -1) != '/') {
+    $path .= '/';
+}
+$urls['path'] = $path;
+$_W['siteroot'] = $urls['scheme'] . '://' . $urls['host'] . (!empty($urls['port']) && $urls['port'] != '80' ? ':' . $urls['port'] : '') . $urls['path'];
+//load()->web('common');
+//load()->web('template');
+if (empty($_W['isfounder']) && !empty($_W['user']) && $_W['user']['status'] == 1) {
+    message('您的账号正在审核或是已经被系统禁止,请联系网站管理员解决!');
+}
+$acl = array('user' => array('default' => 'login', 'direct' => array('login', 'register', 'logout')));
+if ($_W['setting']['copyright']['status'] == 1 && empty($_W['isfounder']) && $controller != 'cloud' && $controller != 'utility' && $controller != 'account') {
+    $_W['siteclose'] = true;
+    if ($controller == 'account' && $action == 'welcome') {
+        template('account/welcome');
+        exit;
+    }
+    if ($controller == 'user' && $action == 'login') {
+        if (checksubmit()) {
+            require _forward($controller, $action);
+        }
+        template('user/login');
+        exit;
+    }
+    isetcookie('__session', '', -10000);
+    message('站点已关闭,关闭原因:' . $_W['setting']['copyright']['reason'], url('account/welcome'), 'info');
+}
+$controllers = array();
+$handle = opendir(IA_ROOT . '/web/source/');
+if (!empty($handle)) {
+    while ($dir = readdir($handle)) {
+        if ($dir != '.' && $dir != '..') {
+            $controllers[] = $dir;
+        }
+    }
+}
+if (!in_array($controller, $controllers)) {
+    $controller = 'account';
+}
+$init = IA_ROOT . "/web/source/{$controller}/__init.php";
+if (is_file($init)) {
+    require $init;
+}
+$actions = array();
+$handle = opendir(IA_ROOT . '/web/source/' . $controller);
+if (!empty($handle)) {
+    while ($dir = readdir($handle)) {
+        if ($dir != '.' && $dir != '..' && strexists($dir, '.ctrl.php')) {
+            $dir = str_replace('.ctrl.php', '', $dir);
+            $actions[] = $dir;
+        }
+    }
+}
+if (empty($actions)) {
+    header('location: ?refresh');
+}
+if (!in_array($action, $actions)) {
+    $action = $acl[$controller]['default'];
+}
+if (!in_array($action, $actions)) {
+    $action = $actions[0];
+}
+$_W['page'] = array();
+$_W['page']['copyright'] = $_W['setting']['copyright'];
+if (is_array($acl[$controller]['direct']) && in_array($action, $acl[$controller]['direct'])) {
+    require _forward($controller, $action);
+    exit;
+}
+if (is_array($acl[$controller]['founder']) && in_array($action, $acl[$controller]['founder'])) {
+    if (!$_W['isfounder']) {
+        message('不能访问, 需要创始人权限才能访问.');
+    }
+}
+checklogin();
+if (!defined('IN_GW')) {
+    //	checkaccount();
+    if (!in_array($_W['role'], array('manager', 'operator', 'founder', 'clerk'))) {
+        //		message('您的账号没有访问此公众号的权限.');
+    }
+}
+require _forward($controller, $action);
+define('ENDTIME', microtime());
+if (empty($_W['config']['setting']['maxtimeurl'])) {
+    $_W['config']['setting']['maxtimeurl'] = 10;
+}
+if (ENDTIME - STARTTIME > $_W['config']['setting']['maxtimeurl']) {
+    $data = array('type' => '1', 'runtime' => ENDTIME - STARTTIME, 'runurl' => $_W['sitescheme'] . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'createtime' => TIMESTAMP);
+    pdo_insert('core_performance', $data);
+}
+function _forward($c, $a)
+{
+    $file = dianc_ROOT . '/admin/source/' . $c . '/' . $a . '.ctrl.php';
+    return $file;
+}
+function _calc_current_frames(&$frames)
+{
+    global $controller, $action;
+    if (!empty($frames) && is_array($frames)) {
+        foreach ($frames as &$frame) {
+            if (empty($frame['items'])) {
+                continue;
+            }
+            foreach ($frame['items'] as &$fr) {
+                $query = parse_url($fr['url'], PHP_URL_QUERY);
+                parse_str($query, $urls);
+                if (empty($urls)) {
+                    continue;
+                }
+                if (defined('ACTIVE_FRAME_URL')) {
+                    $query = parse_url(ACTIVE_FRAME_URL, PHP_URL_QUERY);
+                    parse_str($query, $get);
+                } else {
+                    $get = $_GET;
+                    $get['c'] = $controller;
+                    $get['a'] = $action;
+                }
+                if (!empty($do)) {
+                    $get['do'] = $do;
+                }
+                $diff = array_diff_assoc($urls, $get);
+                if (empty($diff)) {
+                    $fr['active'] = ' active';
+                }
+            }
+        }
+    }
+}

+ 31 - 0
server/addons/hyb_o2o/admin/source/site/entry.ctrl.php

xqd
@@ -0,0 +1,31 @@
+<?php
+
+/**
+ * 派单o2o模块小程序接口定义
+ * 版权归山西网博思创网络科技有限公司所有
+ * https://www.webStrongtech.net
+ * 作者 陌笙
+**/
+defined('IN_IA') or exit('Access Denied');
+load()->model('module');
+load()->model('extension');
+$entry = array('module' => $_GPC['m'], 'do' => $_GPC['do'], 'state' => $_GPC['state'], 'direct' => $_GPC['direct']);
+$_GPC['__entry'] = $entry['title'];
+$_GPC['__state'] = $entry['state'];
+$_GPC['state'] = $entry['state'];
+$_GPC['m'] = $entry['module'];
+$_GPC['do'] = $entry['do'];
+$modules = uni_modules();
+$_W['current_module'] = $modules[$entry['module']];
+$site = WeUtility::createModuleSite($entry['module']);
+$method = 'doWeb' . ucfirst($entry['do']);
+define('IN_MODULE', $entry['module']);
+if (!is_error($site)) {
+    $sysmodule = system_modules();
+    if (in_array($m, $sysmodule)) {
+        $site_urls = $site->getTabUrls();
+    }
+    $method = 'doWeb' . ucfirst($entry['do']);
+    exit($site->{$method}());
+}
+exit("访问的方法 {$method} 不存在.");

+ 32 - 0
server/addons/hyb_o2o/admin/source/user/login.ctrl.php

xqd
@@ -0,0 +1,32 @@
+<?php
+
+defined('IN_IA') or exit('Access Denied');
+define('IN_GW', true);
+$setting = $_W['setting'];
+if (checksubmit('submit')) {
+    $username = trim($_GPC['username']);
+    $password = trim($_GPC['password']);
+    if (empty($username)) {
+        message('请输入要登录的用户名');
+    }
+    if (empty($password)) {
+        message('请输入要登录的用户密码');
+    }
+    //查询
+    $uniacid = $_GPC['uid'];
+    $zhanghao = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_zhanghao") . " WHERE uniacid=:uniacid and zhanghao=:zhanghao", array(":uniacid" => $uniacid, ":zhanghao" => $username));
+    if (empty($zhanghao)) {
+        message('您的账号不存在!');
+    } else {
+        if ($zhanghao['status'] == "1") {
+            message('您的账号已经被系统禁止,请联系平台管理员解决!');
+        } elseif ($zhanghao['status'] == "2") {
+            if ($password != $zhanghao['mima']) {
+                message('您的输入的登录密码不正确,请重新输入或请联系平台管理员解决!');
+            } elseif ($password == $zhanghao['mima']) {
+                message("登录成功!", url('site/entry/', array('m' => 'hyb_o2o', 'id' => $zhanghao['z_shangjia'], 'do' => 'start', "uid" => $uniacid)), 'success');
+            }
+        }
+    }
+}
+template('user/login');

+ 14 - 0
server/addons/hyb_o2o/admin/source/user/logout.ctrl.php

xqd
@@ -0,0 +1,14 @@
+<?php
+
+/**
+ * [WeEngine System] Copyright (c) 2014 WE7.CC
+ * WeEngine is NOT a free software, it under the license terms, visited http://www.efwww.com/ for more details.
+ */
+defined('IN_IA') or exit('Access Denied');
+isetcookie('__session', '', -10000);
+$forward = $_GPC['forward'];
+if (empty($forward)) {
+    $forward = './?refersh';
+}
+// var_dump($_GPC['uid']);
+header('Location:' . url('user/login') . 'uid=' . $_GPC['uid']);

+ 7 - 0
server/addons/hyb_o2o/admin/source/utility/__init.php

xqd
@@ -0,0 +1,7 @@
+<?php
+
+/**
+ * [WeEngine System] Copyright (c) 2014 WE7.CC
+ * WeEngine is NOT a free software, it under the license terms, visited http://www.efwww.com/ for more details.
+ */
+define('IN_GW', true);

+ 8 - 0
server/addons/hyb_o2o/admin/themes/default/common/footer-base.html

xqd
@@ -0,0 +1,8 @@
+	<script type="text/javascript">
+		require(['bootstrap']);
+		$('.js-clip').each(function(){
+			util.clip(this, $(this).attr('data-url'));
+		});
+	</script>
+</body>
+</html>

+ 33 - 0
server/addons/hyb_o2o/admin/themes/default/common/footer-cms.html

xqd
@@ -0,0 +1,33 @@
+		</div>
+		<script type="text/javascript">
+			require(['bootstrap']);
+			{if $_W['uid']}
+				function checknotice() {
+					$.post("{php echo url('utility/notice')}", {}, function(data){
+						var data = $.parseJSON(data);
+						$('#notice-container').html(data.notices);
+						$('#notice-total').html(data.total);
+						if(data.total > 0) {
+							$('#notice-total').css('background', '#ff9900');
+						} else {
+							$('#notice-total').css('background', '');
+						}
+						setTimeout(checknotice, 60000);
+					});
+				}
+				checknotice();
+			{/if}
+		</script>
+		<div class="container-fluid footer" role="footer">
+			<div class="page-header"></div>
+			<span class="pull-left">
+				<p>{if empty($_W['setting']['copyright']['footerleft'])}Powered by <a href="http://www.xxx.cc"><b>餐饮</b></a> v{IMS_VERSION} &copy; 2014-2015 <a href="http://www.xxx.cc">www.we7.cc</a>{else}{$_W['setting']['copyright']['footerleft']}{/if}{if !empty($_W['setting']['copyright']['statcode'])}{$_W['setting']['copyright']['statcode']}{/if}</p>
+			</span>
+			<span class="pull-right">
+				<p>{if empty($_W['setting']['copyright']['footerright'])}<a href="http://www.xxx.cc">关于餐饮2
+				</a>&nbsp;&nbsp;<a href="http://bbs.we7.cc">餐饮论坛</a>&nbsp;&nbsp;<a href="http://wpa.b.qq.com/cgi/wpa.php?ln=1&key=XzkzODAwMzEzOV8xNzEwOTZfNDAwMDgyODUwMl8yXw">联系客服</a>{else}{$_W['setting']['copyright']['footerright']}{/if}</p>
+			</span>
+		</div>
+		{if !empty($_W['setting']['copyright']['statcode'])}{$_W['setting']['copyright']['statcode']}{/if}
+	</body>
+</html>

+ 54 - 0
server/addons/hyb_o2o/admin/themes/default/common/footer-gw.html

xqd
@@ -0,0 +1,54 @@
+			</div>
+		</div>
+		<script type="text/javascript">
+			require(['bootstrap']);
+			{if $_W['isfounder'] && !defined('IN_MESSAGE')}
+			function checkupgrade() {
+				require(['util'], function(util) {
+					if (util.cookie.get('checkupgrade_sys')) {
+						return;
+					}
+					$.getJSON("{url 'utility/checkupgrade/system'}", function(ret){
+						if (ret && ret.message && ret.message.upgrade == '1') {
+							$('body').prepend('<div id="upgrade-tips" class="upgrade-tips"><a href="./index.php?c=cloud&a=upgrade&">系统检测到新版本 '+ret.message.version+' ('+ ret.message.release +') ,请尽快更新!</a><span class="tips-close" style="background:#d03e14;" onclick="checkupgrade_hide();"><i class="fa fa-times-circle"></i></span></div>');
+							if ($('#upgrade-tips-module').size()) {
+								$('#upgrade-tips').css('top', '25px');
+							}
+						}
+					});
+				});
+			}
+
+			function checkupgrade_hide() {
+				require(['util'], function(util) {
+					util.cookie.set('checkupgrade_sys', 1, 3600);
+					$('#upgrade-tips').hide();
+				});
+			}
+			$(function(){
+				checkupgrade();
+			});
+			{/if}
+
+			{if $_W['uid']}
+				function checknotice() {
+					$.post("{php echo url('utility/notice')}", {}, function(data){
+						var data = $.parseJSON(data);
+						$('#notice-container').html(data.notices);
+						$('#notice-total').html(data.total);
+						if(data.total > 0) {
+							$('#notice-total').css('background', '#ff9900');
+						} else {
+							$('#notice-total').css('background', '');
+						}
+						setTimeout(checknotice, 60000);
+					});
+				}
+				checknotice();
+			{/if}
+		</script>
+	</div>
+			{if !empty($_W['setting']['copyright']['statcode'])}{$_W['setting']['copyright']['statcode']}{/if}
+
+</body>
+</html>

+ 71 - 0
server/addons/hyb_o2o/admin/themes/default/common/footer.html

xqd
@@ -0,0 +1,71 @@
+			</div>
+		</div>
+	</div>
+	<script>
+		function subscribe(){
+			$.post("{url 'utility/subscribe'}", function(){
+				setTimeout(subscribe, 5000);
+			});
+		}
+		function sync() {
+			$.post("{url 'utility/sync'}", function(){
+				setTimeout(sync, 60000);
+			});
+		}
+		$(function(){
+			subscribe();
+			sync();
+		});
+		{if $_W['uid']}
+			function checknotice() {
+				$.post("{php echo url('utility/notice')}", {}, function(data){
+					var data = $.parseJSON(data);
+					$('#notice-container').html(data.notices);
+					$('#notice-total').html(data.total);
+					if(data.total > 0) {
+						$('#notice-total').css('background', '#ff9900');
+					} else {
+						$('#notice-total').css('background', '');
+					}
+					setTimeout(checknotice, 60000);
+				});
+			}
+			checknotice();
+		{/if}
+		{if defined('IN_MODULE')}
+		$.getJSON("{url 'utility/checkupgrade/module' array('m' => IN_MODULE)}", function(result) {
+			if (result.message.errno == -10) {
+				$('body').prepend('<div id="upgrade-tips-module" class="upgrade-tips"><a href="http://wpa.b.qq.com/cgi/wpa.php?ln=1&key=XzkzODAwMzEzOV8xNzEwOTZfNDAwMDgyODUwMl8yXw" target="_blank">' + result.message.message + '</a></div>');
+				if ($('#upgrade-tips').size()) {
+					$('#upgrade-tips-module').css('top', '25px');
+				}
+			}
+		});
+		{/if}
+		{php echo site_profile_perfect_tips();}
+
+		// 平台自营
+		// $(function(){
+		// 	$("#frame-0").show();
+	 //        $("#yframe-0").addClass("wyactive");
+	 //        $("wyactive").children("icon").children("img").replaceWith("<img class='fa' src='../addons/hyb_o2o/template/icon/0003.png'></img>");
+  //   	});
+        // 商品管理
+     //    $(function(){
+     //        $("#frame-1").show();
+     //        $("#yframe-1").addClass("wyactive").children("icon").children("img").replaceWith("<img class='fa' src='../addons/hyb_o2o/template/icon/0001.png'></img>");
+     //    });
+     //    // 服务管理
+     //    $(function(){
+	    //     $("#frame-2").show();
+	    //     $("#yframe-2").addClass("wyactive").children("icon").children("img").replaceWith("<img class='fa' src='../addons/hyb_o2o/template/icon/0002.png'></img>");
+	    // })
+	    // // 商家管理
+	    // $(function(){
+	    //     $("#frame-3").show();
+	    //     $("#yframe-3").addClass("wyactive").children("icon").children("img").replaceWith("<img class='fa' src='../addons/hyb_o2o/template/icon/0015.png'></img>");
+	    // })
+	    // 会员管理
+
+	</script>
+{template 'common/footer-base'}

+ 44 - 0
server/addons/hyb_o2o/admin/themes/default/common/header-base.html

xqd
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html lang="zh-cn">
+<head>
+	<meta charset="utf-8">
+	<meta http-equiv="X-UA-Compatible" content="IE=edge">
+	<meta name="viewport" content="width=device-width, initial-scale=1.0">
+	<title>商户后台</title>
+	<meta name="keywords" content="{if empty($_W['page']['copyright']['keywords'])}{else}{$_W['page']['copyright']['keywords']}{/if}" />
+	<meta name="description" content="{if empty($_W['page']['copyright']['description'])}{else}{$_W['page']['copyright']['description']}{/if}" />
+	<link rel="shortcut icon" href="{$_W['siteroot']}{$_W['config']['upload']['attachdir']}/{if !empty($_W['setting']['copyright']['icon'])}{$_W['setting']['copyright']['icon']}{else}images/global/wechat.jpg{/if}" />
+	<link href="{$_W['siteroot']}/web/resource/css/bootstrap.min.css" rel="stylesheet">
+	<link href="{$_W['siteroot']}/web/resource/css/font-awesome.min.css" rel="stylesheet">
+	<link href="{$_W['siteroot']}/web/resource/css/common.css" rel="stylesheet">
+
+	<script type="text/javascript">
+	if(navigator.appName == 'Microsoft Internet Explorer'){
+		if(navigator.userAgent.indexOf("MSIE 5.0")>0 || navigator.userAgent.indexOf("MSIE 6.0")>0 || navigator.userAgent.indexOf("MSIE 7.0")>0) {
+			alert('您使用的 IE 浏览器版本过低, 推荐使用 Chrome 浏览器或 IE8 及以上版本浏览器.');
+		}
+	}
+	window.sysinfo = {
+		{if !empty($_W['uniacid'])}'uniacid': '{$_W['uniacid']}',{/if}
+		{if !empty($_W['acid'])}'acid': '{$_W['acid']}',{/if}
+		{if !empty($_W['openid'])}'openid': '{$_W['openid']}',{/if}
+		{if !empty($_W['uid'])}'uid': '{$_W['uid']}',{/if}
+		'siteroot': '{$_W['siteroot']}',
+		'siteurl': '{$_W['siteurl']}',
+		'attachurl': '{$_W['attachurl']}',
+		'attachurl_local': '{$_W['attachurl_local']}',
+		'attachurl_remote': '{$_W['attachurl_remote']}',
+		{if defined('MODULE_URL')}'MODULE_URL': '{MODULE_URL}',{/if}
+		'cookie' : {'pre': '{$_W['config']['cookie']['pre']}'},
+		'account' : {php echo json_encode($_W['account'])}
+	};
+	</script>
+	<script>var require = { urlArgs: 'v=20161011' };</script>
+	<script type="text/javascript" src="{$_W['siteroot']}/web/resource/js/lib/jquery-1.11.1.min.js"></script>
+	<script type="text/javascript" src="{$_W['siteroot']}/web/resource/js/app/util.js?v=20161011"></script>
+	<script type="text/javascript" src="{$_W['siteroot']}/web/resource/js/app/common.min.js?v=20161011"></script>
+	<script type="text/javascript" src="{$_W['siteroot']}/web/resource/js/require.js?v=20161011"></script>
+	<script type="text/javascript" src="{$_W['siteroot']}/web/resource/js/app/config.js?v=20161011"></script>
+
+</head>
+<body style="background-color: #eee;background-image: url(../hyb_o2o/template/images/seller_login_bg.jpg);"> 

+ 136 - 0
server/addons/hyb_o2o/admin/themes/default/common/header-cms.html

xqd
@@ -0,0 +1,136 @@
+{template 'common/header-base'}
+	{if !empty($_W['uid'])}
+		{if !empty($_W['uniacid'])}
+			<div class="navbar navbar-inverse navbar-static-top" role="navigation" style="position:static;">
+				<div class="container-fluid">
+					<!-- <ul class="nav navbar-nav">
+						<li><a href="./?refresh"><i class="fa fa-reply-all"></i>返回系统</a></li>
+						{php global $top_nav;}
+						{loop $top_nav $nav}
+							{if !empty($_W['isfounder']) || empty($_W['setting']['permurls']['sections']) || in_array($nav['name'], $_W['setting']['permurls']['sections'])}<li{if FRAME == $nav['name']} class="active"{/if}><a href="{php echo url('home/welcome/' . $nav['name']);}"><i class="{$nav['append_title']}"></i>{$nav['title']}</a></li>{/if}
+						{/loop}
+						<li {if $action == 'emulator'}class="active"{/if}>
+							<a href="{php echo url('utility/emulator');}" target="_blank"><i class="fa fa-mobile"></i> 模拟测试</a>
+						</li>
+						{if IMS_FAMILY != 'x'}
+						<li><a href="http://bbs.we7.cc"><i class="fa fa-comment"></i>餐饮论坛</a></li>
+						<li><a href="http://wpa.b.qq.com/cgi/wpa.php?ln=1&key=XzkzODAwMzEzOV8xNzEwOTZfNDAwMDgyODUwMl8yXw"><i class="fa fa-suitcase"></i>联系客服</a></li>
+						{/if}
+					</ul> -->
+					<ul class="nav navbar-nav navbar-right">
+						<li class="dropdown topbar-notice">
+							<a type="button" data-toggle="dropdown">
+								<i class="fa fa-bell"></i>
+								<span class="badge" id="notice-total">0</span>
+							</a>
+							<div class="dropdown-menu" aria-labelledby="dLabel">
+								<div class="topbar-notice-panel">
+									<div class="topbar-notice-arrow"></div>
+									<div class="topbar-notice-head">
+										<span>系统公告</span>
+										<a href="{php echo url('article/notice-show/list');}" class="pull-right">更多公告>></a>
+									</div>
+									<div class="topbar-notice-body">
+										<ul id="notice-container"></ul>
+									</div>
+								</div>
+							</div>
+						</li>
+						<li class="dropdown">
+							<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" style="display:block; max-width:200px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; "><i class="fa fa-group"></i>{$_W['account']['name']} <b class="caret"></b></a>
+							<ul class="dropdown-menu">
+								{if $_W['role'] != 'operator'}
+								<li><a href="{url 'account/post' array('uniacid' => $_W['uniacid'])}" target="_blank"><i class="fa fa-weixin fa-fw"></i> 编辑当前账号资料</a></li>
+								{/if}
+								<li><a href="{url 'account/display'}" target="_blank"><i class="fa fa-cogs fa-fw"></i> 管理其它公众号</a></li>
+								<li><a href="{url 'utility/emulator'}" target="_blank"><i class="fa fa-mobile fa-fw"></i> 模拟测试</a></li>
+							</ul>
+						</li>
+						<li class="dropdown">
+							<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" style="display:block; max-width:185px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; "><i class="fa fa-user"></i>{$_W['user']['username']} ({if $_W['role'] == 'founder'}系统管理员{elseif $_W['role'] == 'manager'}公众号管理员{else}公众号操作员{/if}) <b class="caret"></b></a>
+							<ul class="dropdown-menu">
+								<li><a href="{url 'user/profile/profile'}" target="_blank"><i class="fa fa-weixin fa-fw"></i> 我的账号</a></li>
+								{if $_W['role'] == 'founder'}
+								<li class="divider"></li>
+								<li><a href="{url 'system/welcome'}" target="_blank"><i class="fa fa-sitemap fa-fw"></i> 系统选项</a></li>
+								<li><a href="{url 'system/welcome'}" target="_blank"><i class="fa fa-cloud-download fa-fw"></i> 自动更新</a></li>
+								<li><a href="{url 'system/updatecache'}" target="_blank"><i class="fa fa-refresh fa-fw"></i> 更新缓存</a></li>
+								<li class="divider"></li>
+								{/if}
+								<li><a href="{url 'user/logout'}"><i class="fa fa-sign-out fa-fw"></i> 退出系统</a></li>
+							</ul>
+						</li>
+					</ul>
+				</div>
+			</div>
+		{else}
+			<div class="navbar navbar-inverse navbar-static-top" role="navigation" style="z-index:1001;">
+				<div class="container-fluid">
+					<!-- <ul class="nav navbar-nav">
+						<li class="active"><a href="./?refresh"><i class="fa fa-cogs"></i>系统管理</a></li>
+						<li><a href="{url 'account/display'}" target="_blank"><i class="fa fa-share"></i>管理公众号</a></li>
+						{if IMS_FAMILY != 'x'}
+						<li><a href="http://bbs.we7.cc"><i class="fa fa-comment"></i>餐饮论坛</a></li>
+						<li><a href="http://wpa.b.qq.com/cgi/wpa.php?ln=1&key=XzkzODAwMzEzOV8xNzEwOTZfNDAwMDgyODUwMl8yXw"><i class="fa fa-suitcase"></i>联系客服</a></li>
+						{/if}
+					</ul> -->
+					<ul class="nav navbar-nav navbar-right">
+						<li class="dropdown">
+							<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" style="display:block; max-width:185px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; "><i class="fa fa-user"></i>{$_W['user']['username']} ({if $_W['role'] == 'founder'}系统管理员{elseif $_W['role'] == 'manager'}公众号管理员{else}公众号操作员{/if}) <b class="caret"></b></a>
+							<ul class="dropdown-menu">
+								<li><a href="{url 'user/profile/profile'}" target="_blank"><i class="fa fa-weixin fa-fw"></i> 我的账号</a></li>
+								{if $_W['role'] != 'operator'}
+								<li class="divider"></li>
+								<li><a href="{url 'system/welcome'}" target="_blank"><i class="fa fa-sitemap fa-fw"></i> 系统选项</a></li>
+								<li><a href="{url 'system/welcome'}" target="_blank"><i class="fa fa-cloud-download fa-fw"></i> 自动更新</a></li>
+								<li><a href="{url 'system/updatecache'}" target="_blank"><i class="fa fa-refresh fa-fw"></i> 更新缓存</a></li>
+								<li class="divider"></li>
+								{/if}
+								<li><a href="{url 'user/logout'}"><i class="fa fa-sign-out fa-fw"></i> 退出系统</a></li>
+							</ul>
+						</li>
+					</ul>
+				</div>
+			</div>
+		{/if}
+	{else}
+		<div class="navbar navbar-inverse navbar-static-top" role="navigation" style="z-index:1001;">
+			<div class="container-fluid container">
+				<ul class="nav navbar-nav navbar-right">
+					<li class="active"><a href="{php echo url('user/register');}"><i class="fa fa-user"></i>注册</a></li>
+					<li><a href="{php echo url('user/login');}"><i class="fa fa-user-plus"></i>登陆</a></li>
+				</ul>
+			</div>
+		</div>
+	{/if}
+
+	<div class="container-fluid">
+		{if defined('IN_MESSAGE')}
+			<div class="jumbotron clearfix alert alert-{$label}">
+				<div class="row">
+					<div class="col-xs-12 col-sm-4 col-md-3 col-lg-2">
+						<i class="fa fa-5x fa-{if $label=='success'}check-circle{/if}{if $label=='danger'}times-circle{/if}{if $label=='info'}info-circle{/if}{if $label=='warning'}exclamation-triangle{/if}"></i>
+					</div>
+					<div class="col-xs-12 col-sm-8 col-md-9 col-lg-10">
+						{if is_array($msg)}
+							<h2>MYSQL 错误:</h2>
+							<p>{php echo cutstr($msg['sql'], 300, 1);}</p>
+							<p><b>{$msg['error'][0]} {$msg['error'][1]}:</b>{$msg['error'][2]}</p>
+						{else}
+						<h2>{$caption}</h2>
+						<p>{$msg}</p>
+						{/if}
+						{if $redirect}
+						<p><a href="{$redirect}" class="alert-link">如果你的浏览器没有自动跳转,请点击此链接</a></p>
+						<script type="text/javascript">
+							setTimeout(function () {
+								 location.href = "{$redirect}";
+							}, 3000);
+						</script>
+						{else}
+							<p>[<a href="javascript:history.go(-1);" class="alert-link">点击这里返回上一页</a>] &nbsp; [<a href="./?refresh" class="alert-link">首页</a>]</p>
+						{/if}
+					</div>
+				</div>
+			</div>
+		{/if}

+ 59 - 0
server/addons/hyb_o2o/admin/themes/default/common/header-gw.html

xqd
@@ -0,0 +1,59 @@
+{template 'common/header-base'}
+<style type="text/css">
+	.xiaoren{width: 67px;height: 97px;position: fixed;right: 20%;bottom: 10%;z-index: 10;}
+	.xiaoren>img{width: 67px;height: 97px;}
+	.ygcheck{
+		margin-top: 15px;
+		display: inline-block;
+		width:100px;
+		height: 100px;
+	}
+	.jumbotron{background-color: rgba(0,0,0,0);border:none;}
+	.alert-success .alert-link,.alert-success{color: #000;}
+</style>
+<div class="gw-container">
+	<div class="navbar navbar-static-top" role="navigation" style="padding-top:20px;">
+		<div class="container-fluid">
+		</div>
+	</div>
+	<div class="container-fluid">
+		{if defined('IN_MESSAGE')}
+		<div>
+		<!-- wi text-success wi-right-sign -->
+			<div class="jumbotron clearfix alert alert-{$label}">
+				<div class="row">
+					<div class="col-md-2 col-md-push-3">
+						<img src="../hyb_o2o/template/images/duigoubai.png" class="ygcheck"/>
+					</div>
+					<div class="col-md-5 col-md-push-2">
+						{if is_array($msg)}
+							<h2>MYSQL 错误:</h2>
+							<p>{php echo cutstr($msg['sql'], 300, 1);}</p>
+							<p><b>{$msg['error'][0]} {$msg['error'][1]}:</b>{$msg['error'][2]}</p>
+						{else}
+						<h2>{$caption}</h2>
+						<p>{$msg}</p>
+						{/if}
+						{if $redirect}
+						<p><a href="{$redirect}" class="alert-link">如果你的浏览器没有自动跳转,请点击此链接</a></p>
+						<div class="xiaoren"><img src="../hyb_o2o/template/images/stick.gif"></div>
+						<script type="text/javascript">
+							setTimeout(function () {
+								location.href = "{$redirect}";
+							}, 3000);
+						</script>
+						{else}
+							<p>[<a href="javascript:history.go(-1);" class="alert-link">点击这里返回上一页</a>] &nbsp; [<a href="./?refresh" class="alert-link">首页</a>]</p>
+							<div class="xiaoren"><img src="../hyb_o2o/template/images/stick.gif"></div>
+						{/if}
+					</div>
+				</div>
+			</div>
+		{else}
+		<div class="well">
+		{/if}
+<script>
+	var h = document.documentElement.clientHeight;
+	$(".gw-container").css('min-height',h);
+	{php echo site_profile_perfect_tips();}
+</script>

+ 219 - 0
server/addons/hyb_o2o/admin/themes/default/common/header.html

xqd
@@ -0,0 +1,219 @@
+{template 'common/header-base'}
+<style>
+.navbar-inverse{background-color: rgba(0,0,0,0);border:none;}
+</style>
+	{if $_W['role'] != 'clerk'}
+	<div class="navbar navbar-inverse navbar-static-top" role="navigation" style="position:static;">
+		<div class="container-fluid">
+			 <ul class="nav navbar-nav">
+							<!-- <li><a href="./?refresh"><i class="fa fa-reply-all"></i>返回系统</a></li> -->
+						<!-- 	{php global $top_nav;}
+						{loop $top_nav $nav}
+							{if !empty($_W['isfounder']) || empty($_W['setting']['permurls']['sections']) || in_array($nav['name'], $_W['setting']['permurls']['sections'])}<li{if FRAME == $nav['name']} class="active"{/if}><a href="{php echo url('home/welcome/' . $nav['name']);}"><i class="{$nav['append_title']}"></i>{$nav['title']}</a></li>{/if}
+						{/loop}
+						<li {if $action == 'emulator'}class="active"{/if}>
+							<a href="{php echo url('utility/emulator');}" target="_blank"><i class="fa fa-mobile"></i> 模拟测试</a>
+						</li> -->
+						</ul>  
+			<ul class="nav navbar-nav navbar-right">
+				<!-- <li class="dropdown topbar-notice">
+					<a type="button" data-toggle="dropdown">
+						<i class="fa fa-bell"></i>
+						<span class="badge" id="notice-total">0</span>
+					</a>
+					<div class="dropdown-menu" aria-labelledby="dLabel">
+						<div class="topbar-notice-panel">
+							<div class="topbar-notice-arrow"></div>
+							 <div class="topbar-notice-head">
+								<span>系统公告</span>
+								<a href="{php echo url('article/notice-show/list');}" class="pull-right">更多公告>></a>
+							</div>
+							<div class="topbar-notice-body">
+								<ul id="notice-container"></ul>
+							</div> 
+						</div>
+					</div>
+				</li> -->
+				<!-- <li class="dropdown">
+					<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" style="display:block; max-width:200px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; "><i class="fa fa-group"></i>{$_W['account']['name']} <b class="caret"></b></a>
+				 <ul class="dropdown-menu">
+						{if $_W['role'] != 'operator'}
+						<li><a href="{url 'account/post' array('uniacid' => $_W['uniacid'])}" target="_blank"><i class="fa fa-weixin fa-fw"></i> 编辑当前账号资料</a></li>
+						{/if}
+						<li><a href="{url 'account/display'}" target="_blank"><i class="fa fa-cogs fa-fw"></i> 管理其它公众号</a></li>
+						<li><a href="{url 'utility/emulator'}" target="_blank"><i class="fa fa-mobile fa-fw"></i> 模拟测试</a></li>
+					</ul> 
+				</li> -->
+				<!-- <li class="dropdown">
+				<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" style="display:block; max-width:185px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; "><i class="fa fa-user"></i>{$_W['user']['username']} ({if $_W['role'] == 'founder'}系统管理员{elseif $_W['role'] == 'manager'}公众号管理员{else}公众号操作员{/if}) <b class="caret"></b></a>
+				<ul class="dropdown-menu">
+					<li><a href="{url 'user/profile/profile'}" target="_blank"><i class="fa fa-weixin fa-fw"></i> 我的账号</a></li>
+					{if $_W['role'] == 'founder'}
+					<li class="divider"></li>
+					<li><a href="{url 'system/welcome'}" target="_blank"><i class="fa fa-sitemap fa-fw"></i> 系统选项</a></li>
+					<li><a href="{url 'system/welcome'}" target="_blank"><i class="fa fa-cloud-download fa-fw"></i> 自动更新</a></li>
+					<li><a href="{url 'system/updatecache'}" target="_blank"><i class="fa fa-refresh fa-fw"></i> 更新缓存</a></li>
+					<li class="divider"></li>
+					{/if}
+					<li><a href="{url 'user/logout'}"><i class="fa fa-sign-out fa-fw"></i> 退出系统</a></li>
+				</ul>
+							</li>  -->
+			</ul>
+		</div>
+	</div>
+	{if empty($_COOKIE['check_setmeal']) && !empty($_W['account']['endtime']) && ($_W['account']['endtime'] - TIMESTAMP < (6*86400))}
+		<div class="upgrade-tips" id="setmeal-tips">
+			<a href="{php echo url('user/edit', array('uid' => $_W['account']['uid']));}" target="_blank">
+				您的服务有效期限:{php echo date('Y-m-d', $_W['account']['starttime']);} ~ {php echo date('Y-m-d', $_W['account']['endtime']);}.
+				{if $_W['account']['endtime'] < TIMESTAMP}
+				目前已到期,请联系管理员续费
+				{else}
+				将在{php echo floor(($_W['account']['endtime'] - strtotime(date('Y-m-d')))/86400);}天后到期,请及时付费
+				{/if}
+			</a><span class="tips-close" style="background:#d03e14;" onclick="check_setmeal_hide();"><i class="fa fa-times-circle"></i></span>
+		</div>
+		<script>
+			function check_setmeal_hide() {
+				util.cookie.set('check_setmeal', 1, 1800);
+				$('#setmeal-tips').hide();
+				return false;
+			}
+		</script>
+	{/if}
+	{else}
+		<div class="navbar navbar-inverse navbar-static-top" role="navigation" style="position:static;">
+			<div class="container-fluid">
+				<ul class="nav navbar-nav">
+					<li><a href="{url 'activity/desk/index'}"><i class="fa fa-desktop"></i> 工作台首页</a></li>
+					<li><a href="javascript:;" class="login-qrcode"><i class="fa fa-qrcode"></i> 手机登录</a></li>
+					{if IMS_FAMILY != 'x'}
+						<li><a href="http://bbs.we7.cc"><i class="fa fa-comment"></i>餐饮论坛</a></li>
+						<li><a href="http://wpa.b.qq.com/cgi/wpa.php?ln=1&key=XzkzODAwMzEzOV8xNzEwOTZfNDAwMDgyODUwMl8yXw"><i class="fa fa-suitcase"></i>联系客服</a></li>
+					{/if}
+				</ul>
+				<ul class="nav navbar-nav navbar-right">
+					<li><a href="javascript:;"><i class="fa fa-user"></i> {$_W['user']['name']} - {$_W['user']['store_name']}</a></li>
+					<li><a href="{url 'user/profile/profile'}" target="_blank"><i class="fa fa-weixin fa-fw"></i> 账号信息</a></li>
+					<li><a href="{url 'user/logout'}"><i class="fa fa-sign-out fa-fw"></i> 退出系统</a></li>
+				</ul>
+			</div>
+		</div>
+	{/if}
+	<div class="container-fluid">
+		{if defined('IN_MESSAGE')}
+		<div class="jumbotron clearfix alert alert-{$label}">
+			<div class="row">
+				<div class="col-xs-12 col-sm-3 col-lg-2">
+					<i class="fa fa-5x fa-{if $label=='success'}check-circle{/if}{if $label=='danger'}times-circle{/if}{if $label=='info'}info-circle{/if}{if $label=='warning'}exclamation-triangle{/if}"></i>
+				</div>
+				<div class="col-xs-12 col-sm-8 col-md-9 col-lg-10">
+					{if is_array($msg)}
+						<h2>MYSQL 错误:</h2>
+						<p>{php echo cutstr($msg['sql'], 300, 1);}</p>
+						<p><b>{$msg['error'][0]} {$msg['error'][1]}:</b>{$msg['error'][2]}</p>
+					{else}
+					<h2>{$caption}</h2>
+					<p>{$msg}</p>
+					{/if}
+					{if $redirect}
+					
+					<p><a href="{$redirect}">如果你的浏览器没有自动跳转,请点击此链接</a></p>
+					<script type="text/javascript">
+						setTimeout(function () {
+						/*	location.href = "{$redirect}";*/
+						}, 3000);
+					</script>
+					{else}
+						<p>[<a href="javascript:history.go(-1);">点击这里返回上一页</a>] &nbsp; <!-- [<a href="./?refresh">首页</a>] --></p>
+					{/if}
+				</div>
+		{else}
+		<div class="row">
+			{php $frames = empty($frames) ? $GLOBALS['frames'] : $frames; _calc_current_frames($frames);}
+			{if !empty($frames)}
+				<div class="col-xs-12 col-sm-3 col-lg-2 big-menu">
+					<div id="search-menu">
+						<input class="form-control input-lg" style="border-radius:0; font-size:14px; height:43px;" type="text" placeholder="输入菜单名称可快速查找">
+					</div>
+					{if $GLOBALS['ext_type'] > 0}
+						<div class="btn-group">
+							<button class="btn {if $GLOBALS['ext_type'] == 1}btn-primary{else}btn-default{/if} ext-type" data-id="1">默认</button>
+							<button class="btn {if $GLOBALS['ext_type'] == 2}btn-primary{else}btn-default{/if} ext-type" data-id="2">系统</button>
+							<button class="btn {if $GLOBALS['ext_type'] == 3}btn-primary{else}btn-default{/if} ext-type" data-id="3">复合</button>
+						</div>
+					{/if}
+					{loop $frames $k $frame}
+					<div class="panel panel-default">
+						<div class="panel-heading">
+							<h4 class="panel-title">{$frame['title']}</h4>
+							<a class="panel-collapse collapsed" data-toggle="collapse" href="#frame-{$k}">
+								<i class="fa fa-chevron-circle-down"></i>
+							</a>
+						</div>
+						<ul class="list-group collapse in" id="frame-{$k}">
+							{loop $frame['items'] $link}
+							{if empty($link['is_permission'])}
+								{if !empty($link['append'])}
+								<li class="list-group-item{$link['active']}" onclick="window.location.href = '{$link['url']}';" style="cursor:pointer; overflow:hidden;" kw="{$link['title']}">
+									<a class="pull-right" href="{$link['append']['url']}">{$link['append']['title']}</a>
+									{$link['title']}
+								</li>
+								{else}
+								<a class="list-group-item{$link['active']}" href="{$link['url']}" kw="{$link['title']}">{$link['title']}</a>
+								{/if}
+							{/if}
+							{/loop}
+						</ul>
+					</div>
+					{/loop}
+					<script type="text/javascript">
+						require(['bootstrap'], function(){
+							$('.ext-type').click(function(){
+								var id = $(this).data('id');
+								util.cookie.del('ext_type');
+								util.cookie.set('ext_type', id, 8640000);
+								location.reload();
+								return false;
+							});
+
+							$('#search-menu input').keyup(function() {
+								var a = $(this).val();
+								$('.big-menu .list-group-item, .big-menu .panel-heading').hide();
+								$('.big-menu .list-group-item').each(function() {
+									$(this).css('border-left', '0');
+									if(a.length > 0 && $(this).attr('kw').indexOf(a) >= 0) {
+										$(this).parents(".panel").find('.panel-heading').show();
+										$(this).show().css('border-left', '3px #428bca double');
+									}
+								});
+								if(a.length == 0) {
+									$('.big-menu .list-group-item, .big-menu .panel-heading').show();
+								}
+							});
+						});
+					</script>
+				</div>
+				<div class="col-xs-12 col-sm-9 col-lg-10">
+					{if CRUMBS_NAV == 1}
+						{php global $module_types;global $module;global $ptr_title;}
+						<ol class="breadcrumb" style="padding:5px 0;">
+							<li><a href="{url 'home/welcome/ext'}"><i class="fa fa-cogs"></i> &nbsp; 扩展功能</a></li>
+							<li><a href="{url 'home/welcome/ext' array('m' => $module['name'])}">{$module_types[$module['type']]['title']}模块 - {$module['title']}</a></li>
+							<li class="active">{$ptr_title}</li>
+						</ol>
+					{elseif CRUMBS_NAV == 2}
+						{php global $module_types;global $module;global $ptr_title; global $site_urls; $m = $_GPC['m'];}
+						<ul class="nav nav-tabs">
+							<li><a href="{url 'platform/reply' array('m' => $m)}">管理{$module['title']}</a></li>
+							<li><a href="{url 'platform/reply/post' array('m' => $m)}"><i class="fa fa-plus"></i> 添加{$module['title']}</a></li>
+							{if !empty($site_urls)}
+								{loop $site_urls $site_url}
+									<li {if $_GPC['do'] == $site_url['do']} class="active"{/if}><a href="{$site_url['url']}"> {$site_url['title']}</a></li>
+								{/loop}
+							{/if}
+						</ul>
+					{/if}
+			{else}
+				<div class="col-xs-12 col-sm-12 col-lg-12">
+			{/if}
+		{/if}

+ 8 - 0
server/addons/hyb_o2o/admin/themes/default/common/message.html

xqd
@@ -0,0 +1,8 @@
+{php define('IN_MESSAGE', true)}
+{if defined('IN_GW')}
+{template 'common/header-gw'}
+{template 'common/footer-gw'}
+{else}
+{template 'common/header'}
+{template 'common/footer'}
+{/if}

+ 285 - 0
server/addons/hyb_o2o/admin/themes/default/user/login.html

xqd
@@ -0,0 +1,285 @@
+{template 'common/header-base'}
+<link href="/addons/hyb_o2o/template/public/login.css" rel="stylesheet" type="text/css"/>
+    <style>
+        .clearfix:after{content:".";clear:both;display:block;height:0;overflow:hidden;visibility:hidden;}
+        ul,li{
+            list-style: none;
+        }
+        .headerTop{
+            width:1200px;
+            left:0;
+            right: 0;
+            margin: auto;
+        }
+        .message{
+            float: right;
+            list-style: none;
+        }
+        .message li{
+            float: left;
+            padding: 0px 20px 0px 26px;
+            color:#fff;
+            font-size: 16px;
+            line-height: 30px;
+        }
+        .message li:nth-child(2){
+            padding:0px 20px 0px 0px;
+        }
+        .message li:nth-child(3) a{
+            color:#fff;
+            text-decoration: none;
+        }
+        .message  li .poser{
+            display: none;
+            width:306px;
+            height: 174px;
+            position: absolute;
+            top: 30px;
+            right: 0;
+            background: rgba(233,234,234,0.9);
+            padding: 30px 40px;
+        }
+        .poser dd{
+            text-align: center;
+            color: #333;
+            font-family: "微软雅黑";
+            font-size:14px;
+        }
+        .poser dl{
+            margin-top:0;
+        }
+        .poser dl dt{
+            margin-bottom:5px;
+        }
+
+        .poser dl:nth-child(1){
+            float: left;
+        }
+        .poser dl:nth-child(2){
+            float: right;
+        }
+        .fluid{
+            margin-top:46px;
+        }
+        .form-control{
+            height:40px;
+            padding:6px 22px;
+            font-size: 14px!important;
+        }
+        .form-group{
+            margin-bottom:32px;
+        }
+        .form-group.has-error{
+            margin-bottom:10px;
+        }
+        .login-error{
+            margin-top:-10px;
+        }
+        footer{
+            width: 100%;
+            background: #1d2733;
+        }
+        .footerCon{
+            width: 1200px;
+            margin: 0px auto;
+            position: relative;
+        }
+        .footerTit{
+            position: absolute;
+            top: 125px;
+            left: 105px;
+            width: 227px;
+            height: 55px;
+        }
+        .footerTit h2{
+            color: #fff;
+            font-size: 26px;
+            margin-bottom: 8px;
+        }
+        .footerTit p{
+            color: #fff;
+            font-size: 14px;
+            font-family: "微软雅黑";
+        }
+        .footerRight{
+            width: 538px;
+            float: right;
+            margin-top: 30px;
+            padding-bottom: 40px;
+        }
+        .foT{
+            width: 236px;
+            padding-left: 20px;
+        }
+        .foT li{
+            font-size: 16px;
+            color: #FFF;
+            font-weight: 600;
+        }
+        .foT li:nth-child(1){
+            list-style: disc;
+            float: left;
+        }
+        .foT li:nth-child(2){
+            list-style: disc;
+            float: right;
+        }
+        .fotrcon{
+            width: 100%;
+            border-bottom: 1px solid #6C6D71;
+            margin-top: 20px;
+        }
+        .fotLeft{
+            width: 71px;
+            font-size: 14px;
+            float: left;
+            margin:15px 116px 0px 20px;
+            font-family: "微软雅黑";
+            padding-left:0;
+        }
+        .fotLeft li a,.fotCenter li a{
+            color: #fff;
+        }
+        .fotLeft li,.fotCenter li{
+            margin-bottom: 15px;
+        }
+        .fotCenter{
+            margin-top: 15px;
+            float: left;
+            font-size: 14px;
+            width:65px;
+            font-family: "微软雅黑";
+            color: #fff;
+            padding-left:0;
+        }
+
+        .share{
+            width: 100%;
+            height: 20px;
+            margin-top: 30px;
+        }
+        .address{
+            float: left;
+            color:#fff;
+            font-size: 14px;
+            font-family: "微软雅黑";
+        }
+        .download{
+            margin-top: 15px;
+            width: 181px;
+            float: right;
+        }
+        .download dl:nth-child(1){
+            float: left;
+        }
+        .download dl:nth-child(2){
+            float: right;
+        }
+        .download dd{
+            color:#fff;
+            font-size: 14px;
+            font-family: "微软雅黑";
+            padding-top: 5px;
+        }
+        .shareTo{
+            float: right;
+            width: 78px;
+        }
+        .shareTo a:nth-child(1){
+            float: left;
+        }
+        .shareTo a:nth-child(2){
+            float: right;
+        }
+        @media only screen and (min-width: 100px) and (max-width: 1200px) {
+            footer,.bgpic{
+                width:1200px;
+            }
+
+        }
+        .fotrcon li a{
+            text-decoration: none;
+        }
+        .footer{
+            display: none;
+        }
+    </style>
+
+<?php 
+    global $_W,$_GPC;
+    $uniacid = $_GPC['uid'];
+    $base = pdo_fetch("SELECT * FROM ".tablename("hyb_o2o_base")." WHERE uniacid=:uniacid",array(":uniacid"=>$uniacid));
+    //var_dump($base);
+?>
+
+
+<div class="bgpic" style="background: url(/addons/hyb_o2o/template/images/update_login_bg.jpg) no-repeat ;height: 100vh;background-size: cover;">
+        <div class="headerTop clearfix" style=""> 
+        <!-- 派单logo -->
+                        <img class="header_logo" src="{if empty($base['erweima'])}/addons/hyb_o2o/template/images/icon.jpg{else}../../../attachment/{$base['erweima']}{/if}" style="width: 100px;"/>
+        </div>
+        <div class="content">
+            <div style="overflow: hidden;width: 80%;margin: 30px auto 0;">
+                <div style="float:left;color: #fff;margin-top: 140px">
+                    <div style="font-size: 50px;margin-bottom: 10px;font-weight: bold;">新零售 &nbsp; 始终领先一步</div>
+                    <div style="font-size: 45px;margin-bottom: 10px">因为专注 &nbsp; 所以专业</div>
+                    <div style="font-size: 38px;">派单o2o &nbsp; 引领电商新潮流</div>
+                </div>
+                <form class="form-horizontal" id="login-form" action="" method="post" style="position: relative; background-color: white;width:500px;height: 380px; float: right;margin-top: 100px;"onsubmit="return formcheck();">
+                    <input type="hidden" value="" name="identifier"/>
+                    <div class="fluid" style=" padding:0 67px;text-align: center;">
+                            
+                        <span style="font-size: 24px;color: #333;font-weight: 600;">商户后台登录</span>
+                        
+                    </div>
+                    <div class="form-body" style="padding: 25px 67px 0;">
+                        <div class="form-group">
+                                
+                            <div class="col-md-12">
+                                <input type="text" class="form-control" autocomplete="off" placeholder="请输入登录账号" id="userName" name="username" value="">
+                                    
+                            </div>
+                        </div>
+                        <div class="form-group">
+                                
+                            <div class="col-md-12">
+                                <input class="form-control" type="password" autocomplete="off" placeholder="请输入登录密码" name="password">
+                                    
+                            </div>
+                        </div>
+                        
+                  
+                        <div class="login-error">
+                            <p style="color: red;">
+                                
+                                    
+                            </p>
+                        </div>
+                        <div class="form-group" style="margin-bottom: 20px">
+                            <div class="col-md-12">
+                                <input class="btn btn-lg btn-block" style="background: #F24137;color: #fff;font-size: 22px;" type="submit" id="submit" name="submit" value="登录"  value="登 录" />
+                            </div>
+                        <input name="token" value="{$_W['token']}" type="hidden" />
+                        </div>
+  
+                    </div>     
+                </form>                      
+            </div>
+        </div>
+    </div>
+</body>
+<script>
+	function formcheck() {
+		if($('#remember:checked').length == 1) {
+			cookie.set('remember-username', $(':text[name="username"]').val());
+		} else {
+			cookie.del('remember-username');
+		}
+		return true;
+	}
+	$('#toggle').click(function() {
+		$('#imgverify').prop('src', '{php echo $_W['siteroot'].url("utility/code")}r='+Math.round(new Date().getTime()));
+		return false;
+	});
+</script>
+</html>

+ 52 - 0
server/addons/hyb_o2o/config.php

xqd
@@ -0,0 +1,52 @@
+<?php
+
+defined('IN_IA') or exit('Access Denied');
+$config = array();
+$config['db']['master']['host'] = '127.0.0.1';
+$config['db']['master']['username'] = 'hjsc';
+$config['db']['master']['password'] = '112758zyj';
+$config['db']['master']['port'] = '3306';
+$config['db']['master']['database'] = 'hjsc';
+$config['db']['master']['charset'] = 'utf8';
+$config['db']['master']['pconnect'] = 0;
+$config['db']['master']['tablepre'] = 'ims_';
+$config['db']['slave_status'] = false;
+$config['db']['slave']['1']['host'] = '';
+$config['db']['slave']['1']['username'] = '';
+$config['db']['slave']['1']['password'] = '';
+$config['db']['slave']['1']['port'] = '3307';
+$config['db']['slave']['1']['database'] = '';
+$config['db']['slave']['1']['charset'] = 'utf8';
+$config['db']['slave']['1']['pconnect'] = 0;
+$config['db']['slave']['1']['tablepre'] = 'ims_';
+$config['db']['slave']['1']['weight'] = 0;
+$config['db']['common']['slave_except_table'] = array('core_sessions');
+// --------------------------  CONFIG COOKIE  --------------------------- //
+$config['cookie']['pre'] = '3814_';
+$config['cookie']['domain'] = '';
+$config['cookie']['path'] = '/';
+// --------------------------  CONFIG SETTING  --------------------------- //
+$config['setting']['charset'] = 'utf-8';
+$config['setting']['cache'] = 'mysql';
+$config['setting']['timezone'] = 'Asia/Shanghai';
+$config['setting']['memory_limit'] = '256M';
+$config['setting']['filemode'] = 0644;
+$config['setting']['authkey'] = '059d9adc';
+$config['setting']['founder'] = '1';
+$config['setting']['development'] = 1;
+$config['setting']['referrer'] = 0;
+// --------------------------  CONFIG UPLOAD  --------------------------- //
+$config['upload']['image']['extentions'] = array('gif', 'jpg', 'jpeg', 'png');
+$config['upload']['image']['limit'] = 5000;
+$config['upload']['attachdir'] = 'attachment';
+$config['upload']['audio']['extentions'] = array('mp3');
+$config['upload']['audio']['limit'] = 5000;
+// --------------------------  CONFIG MEMCACHE  --------------------------- //
+$config['setting']['memcache']['server'] = '';
+$config['setting']['memcache']['port'] = 11211;
+$config['setting']['memcache']['pconnect'] = 1;
+$config['setting']['memcache']['timeout'] = 30;
+$config['setting']['memcache']['session'] = 1;
+// --------------------------  CONFIG PROXY  --------------------------- //
+$config['setting']['proxy']['host'] = '';
+$config['setting']['proxy']['auth'] = '';

+ 206 - 0
server/addons/hyb_o2o/cron.php

xqd
@@ -0,0 +1,206 @@
+<?php
+//解密QQ:麒擎网络
+define("IN_SYS", true);
+define("WWW_ROOT", dirname(dirname(dirname(__FILE__))));
+require WWW_ROOT . "/framework/bootstrap.inc.php";
+require WWW_ROOT . "/addons/hyb_o2o/admin/common/attachurl.php";
+require WWW_ROOT . "/addons/hyb_o2o/admin/common/bootstrap.sys.inc.php";
+require WWW_ROOT . "/addons/hyb_o2o/admin/common/template.func.php";
+require WWW_ROOT . "/addons/hyb_o2o/admin/common/common.func.php";
+global $_GPC, $_W;
+if ($_GPC["type"] == "day") {
+    $day = date("Y-m-d", time() - 24 * 3600);
+    $daili_guizhe = $daili_list = pdo_get("hyb_o2o_daili_guizhe");
+    $daili_list = pdo_getall("hyb_o2o_daili");
+    foreach ($daili_list as $key => $value) {
+        $_W["uniacid"] = $uniacid = $value["uniacid"];
+        $city = $value["city"];
+        $order_fuwu_money = pdo_fetchcolumn("SELECT sum(o_count_money) FROM " . tablename("hyb_o2o_orderfuwu") . " WHERE uniacid={$uniacid} and o_status>=50 and o_status<=60 and wc_time like '%{$day}%' and  o_address like '%{$value["city"]}%'");
+        $order_jishi_money = pdo_fetchcolumn("SELECT sum(o_money) FROM " . tablename("hyb_o2o_orderjishi") . " WHERE uniacid={$uniacid} and o_status='已完成'  and wc_time like '%{$day}%' and  o_address like '%{$value["city"]}%'");
+        $order_goods_money = pdo_fetchcolumn("SELECT sum(o_count_money) FROM " . tablename("hyb_o2o_ordergoods") . " WHERE uniacid={$uniacid} and o_type='已完成'  and wc_time like '%{$day}%' and  o_address like '%{$value["city"]}%'");
+        $order_fadan_money = pdo_fetchcolumn("SELECT sum(fa_fwmoney) FROM " . tablename("hyb_o2o_fadan") . " WHERE uniacid={$uniacid} and fa_style='已完成'  and wc_time like '%{$day}%' and  fa_dizhi like '%{$value["city"]}%'");
+        daili_mingxi($value["id"], $order_fuwu_money * $daili_guizhe["bili"], 1, "服务订单当日结算", $day);
+        daili_mingxi($value["id"], $order_jishi_money * $daili_guizhe["bili"], 2, "技师直约订单当日结算", $day);
+        daili_mingxi($value["id"], $order_goods_money * $daili_guizhe["bili"], 3, "商品订单当日结算", $day);
+        daili_mingxi($value["id"], $order_fadan_money * $daili_guizhe["bili"], 4, "发单订单当日结算", $day);
+        pdo_update("hyb_o2o_daili", array("money +=" => $order_fuwu_money * $daili_guizhe["bili"], +$order_jishi_money * $daili_guizhe["bili"], +$order_goods_money * $daili_guizhe["bili"], +$order_fadan_money * $daili_guizhe["bili"]), array("id" => $value["id"]));
+    }
+}
+if ($_GPC["type"] == "hour") {
+    return false;
+}
+if ($_GPC["type"] == "min") {
+    $qiangdan_guizhe = pdo_getall("hyb_o2o_qiangdan_guizhe");
+    foreach ($qiangdan_guizhe as $key => $val) {
+        $_W["uniacid"] = $uniacid = $val["uniacid"];
+        $overtime_confirm = $val["overtime_confirm"];
+        $overtime_comment = $val["overtime_comment"];
+        $overtime_qiangdan = $val["overtime_qiangdan"];
+        $shouhou_time = $val["shouhou_time"];
+        $jiedan_fanhuan = $val["jiedan_fanhuan"];
+        $overtime_cancel = $val["overtime_cancel"];
+        if ($overtime_cancel > 0) {
+            $fadan_list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fadan") . " WHERE uniacid={$uniacid} and fa_style='派单中'");
+            foreach ($fadan_list as $key => $value) {
+                if (strtotime($value["fa_time"]) + $overtime_cancel * 60 < time()) {
+                    pdo_update("hyb_o2o_fadan", array("fa_style" => "已取消"), array("fa_id" => $value["fa_id"]));
+                    $money = $value["fa_fwmoney"] + $value["fa_fwshagneng"];
+                    pdo_update("hyb_o2o_userinfo", array("money +=" => $money), array("fa_id" => $value["fa_id"]));
+                    usermoney_log($value["u_id"], $money, 3, "发单超时取消", $value["fa_id"], $value["fa_ordersn"]);
+                }
+            }
+        }
+        if ($overtime_qiangdan > 0) {
+            $sql = "SELECT * FROM " . tablename("hyb_o2o_fadan") . " as a left join " . tablename("hyb_o2o_qiangdan") . " as b on b.q_pdname=a.fa_id WHERE  b.q_styles='已派单'  and  b.uniacid={$uniacid}";
+            $fadan_list = pdo_fetchall($sql);
+            foreach ($fadan_list as $key => $value) {
+                if (strtotime($value["q_time"]) + $overtime_qiangdan * 60 < time()) {
+                    $datas = array();
+                    $datas["fa_style"] = "派单中";
+                    $datas["fa_fwmoney"] = 0;
+                    $datas["fa_fwpay_types"] = 0;
+                    pdo_update("hyb_o2o_fadan", $datas, array("fa_id" => $value["fa_id"]));
+                    pdo_delete("hyb_o2o_qiangdan", array("q_id" => $value["q_id"]));
+                }
+            }
+        }
+        if ($overtime_comment > 0) {
+            $sql = "SELECT * FROM " . tablename("hyb_o2o_fadan") . " as a left join " . tablename("hyb_o2o_qiangdan") . " as b on b.q_pdname=a.fa_id WHERE  b.q_styles='已完成' and  a.pingjia=0   and  b.uniacid={$uniacid}";
+            $fadan_list = pdo_fetchall($sql);
+            foreach ($fadan_list as $key => $value) {
+                if (strtotime($value["fa_time"]) + $overtime_comment * 24 * 3600 < time()) {
+                    pdo_update("hyb_o2o_fadan", array("pingjia" => 1), array("fa_id" => $value["fa_id"]));
+                    $yuangong_info = pdo_get("hyb_o2o_yuangong", array("y_openid" => $value["q_openid"]));
+                    $data = array("uniacid" => $uniacid, "pj_openid" => $openid, "pj_content" => "超时未评价,系统默认好评", "pj_fen" => 5, "pj_yuangong" => $yuangong_info["y_id"], "pj_time" => date("Y-m-d H:i:s", time()), "pj_name" => $value["fa_name"], "u_id" => $user_info["u_id"]);
+                    $res = pdo_insert("hyb_o2o_paidanpingjia", $data);
+                }
+            }
+        }
+        if ($shouhou_time > 0) {
+            $fadan_list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fadan") . " WHERE uniacid={$uniacid} and yanshou<3 and shouhou=0");
+            foreach ($fadan_list as $key => $value) {
+                if (strtotime($value["yanshou_time"]) + $shouhou_time * 24 * 3600 > time()) {
+                    $url = $_W["setting"]["site"]["url"] . "/app/index.php?i=" . $uniacid . "&t=0&v=2.0.0&from=wxapp&c=entry&a=wxapp&do=Userfadanwc&m=hyb_o2o&fa_id=" . $value["fa_id"];
+                    httpGet($url);
+                }
+            }
+        }
+    }
+    $orderbase = pdo_getall("hyb_o2o_orderbase");
+    foreach ($orderbase as $key => $val) {
+        $_W["uniacid"] = $uniacid = $val["uniacid"];
+        $goods_overtime_confirm = $val["goods_overtime_confirm"];
+        $fuwu_overtime_confirm = $val["fuwu_overtime_confirm"];
+        $overtime_comment = $val["overtime_comment"];
+        $overtime_qiangdan = $val["overtime_qiangdan"];
+        $shouhou_time = $val["shouhou_time"];
+        $jiedan_fanhuan = $val["jiedan_fanhuan"];
+        $overtime_cancel = $val["overtime_cancel"];
+        if ($overtime_cancel > 0) {
+            $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_orderfuwu") . " WHERE uniacid={$uniacid} and o_status in(10,11,12)");
+            foreach ($list as $key => $value) {
+                if (strtotime($value["o_xdtime"]) + $overtime_cancel * 60 < time()) {
+                    pdo_update("hyb_o2o_orderfuwu", array("o_status" => "0"), array("o_id" => $value["o_id"]));
+                }
+            }
+            $goods_list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_ordergoods") . " WHERE uniacid={$uniacid} and o_type='未支付'");
+            foreach ($list as $key => $value) {
+                if (strtotime($value["o_xdtime"]) + $overtime_cancel * 60 < time()) {
+                    pdo_update("hyb_o2o_ordergoods", array("o_type" => "已取消"), array("o_id" => $value["o_id"]));
+                }
+            }
+        }
+        if ($overtime_comment > 0) {
+            $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_orderfuwu") . " WHERE uniacid={$uniacid} and o_status>=50 and o_status<60 and o_pingjia=0");
+            foreach ($list as $key => $value) {
+                if (strtotime($value["wc_time"]) + $overtime_comment * 60 < time()) {
+                    pdo_update("hyb_o2o_orderfuwu", array("o_pingjia" => "1"), array("o_id" => $value["o_id"]));
+                    $url = $_W["setting"]["site"]["url"] . "/app/index.php?i=" . $uniacid . "&t=0&v=2.0.0&from=wxapp&c=entry&a=wxapp&do=Addfwpingjia&m=hyb_o2o&o_id=" . $value["o_id"];
+                    $datas = array("openid" => $value["openid"], "o_id" => $value["o_id"], "p_content" => "超时未评价,系统默认好评", "fw_pingfen" => 5, "sp_pingfen" => 5, "yg_pingfen" => 5);
+                    $a = ihttp_post($url, $datas);
+                }
+            }
+            $goods_list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_ordergoods") . " WHERE uniacid={$uniacid} and o_type='已完成' and o_pingjia=0");
+            foreach ($goods_list as $key => $value) {
+                if (strtotime($value["wc_time"]) + $overtime_comment * 60 < time()) {
+                    pdo_update("hyb_o2o_ordergoods", array("o_pingjia" => "1"), array("o_id" => $value["o_id"]));
+                    $url = $_W["setting"]["site"]["url"] . "/app/index.php?i=" . $uniacid . "&t=0&v=2.0.0&from=wxapp&c=entry&a=wxapp&do=Addgoodspingjia&m=hyb_o2o";
+                    $datas = array("openid" => $value["openid"], "o_id" => $value["o_id"], "p_content" => "超时未评价,系统默认好评", "sp_pingfen" => 5);
+                    ihttp_post($url, $datas);
+                }
+            }
+            $jishi_list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_orderjishi") . " WHERE uniacid={$uniacid} and o_status='已完成' and o_pingjia=0");
+            foreach ($goods_list as $key => $value) {
+                if (strtotime($value["wc_time"]) + $overtime_comment * 60 < time()) {
+                    $url = $_W["setting"]["site"]["url"] . "/app/index.php?i=" . $uniacid . "&t=0&v=2.0.0&from=wxapp&c=entry&a=wxapp&do=Orderjishiyuyuepingjia&m=hyb_o2o";
+                    $datas = array("openid" => $value["openid"], "o_id" => $value["o_id"], "plcont" => "超时未评价,系统默认好评", "fuwupf" => 5, "zonghepf" => 5);
+                    ihttp_post($url, $datas);
+                }
+            }
+        }
+        if ($fuwu_overtime_confirm > 0) {
+            $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_orderfuwu") . " WHERE uniacid={$uniacid} and o_status in(30)");
+            foreach ($list as $key => $value) {
+                if (strtotime($value["o_xdtime"]) + $fuwu_overtime_confirm * 60 < time()) {
+                    break;
+                }
+            }
+            $goods_overtime_confirm = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_ordergoods") . " WHERE uniacid={$uniacid} and o_type='未支付'");
+            foreach ($list as $key => $value) {
+                if (strtotime($value["fh_time"]) + $fuwu_overtime_confirm * 60 < time()) {
+                    pdo_update("hyb_o2o_ordergoods", array("o_type" => "已取消"), array("o_id" => $value["o_id"]));
+                }
+            }
+        }
+    }
+}
+function usermoney_log($u_id, $money, $type, $content, $o_id, $ordersn)
+{
+    global $_GPC, $_W;
+    $uniacid = $_W["uniacid"];
+    $arr = array();
+    $arr[1] = "用户充值";
+    $arr[2] = "服务订单";
+    $arr[4] = "商品订单";
+    $arr[3] = "发单订单";
+    $data = array();
+    $data["uniacid"] = $uniacid;
+    $data["u_id"] = $u_id;
+    $data["money"] = $money;
+    $data["type"] = $type;
+    $data["content"] = $content;
+    $data["o_id"] = $o_id;
+    $data["ordersn"] = $ordersn;
+    $data["addtime"] = date("Y-m-d H:i:s", time());
+    pdo_insert("hyb_o2o_usermoney_log", $data);
+}
+function daili_mingxi($d_id, $money, $type, $content, $day)
+{
+    global $_GPC, $_W;
+    $uniacid = $_W["uniacid"];
+    $arr = array();
+    $arr[1] = "用户充值";
+    $arr[2] = "服务订单";
+    $arr[4] = "商品订单";
+    $arr[3] = "发单订单";
+    $data = array();
+    $data["uniacid"] = $uniacid;
+    $data["d_id"] = $d_id;
+    $data["money"] = $money;
+    $data["type"] = $type;
+    $data["content"] = $content;
+    $data["day"] = $day;
+    $data["addtime"] = date("Y-m-d H:i:s", time());
+    pdo_insert("hyb_o2o_daili_mingxi", $data);
+}
+function httpGet($url)
+{
+    $curl = curl_init();
+    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
+    curl_setopt($curl, CURLOPT_TIMEOUT, 500);
+    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
+    curl_setopt($curl, CURLOPT_URL, $url);
+    $res = curl_exec($curl);
+    curl_close($curl);
+    return $res;
+}

+ 10 - 0
server/addons/hyb_o2o/errorCode.php

xqd
@@ -0,0 +1,10 @@
+<?php
+
+class ErrorCode
+{
+    public static $OK = 0;
+    public static $IllegalAesKey = -41001;
+    public static $IllegalIv = -41002;
+    public static $IllegalBuffer = -41003;
+    public static $DecodeBase64Error = -41004;
+}

BIN
server/addons/hyb_o2o/icon-custom.jpg


BIN
server/addons/hyb_o2o/icon.jpg


+ 50 - 0
server/addons/hyb_o2o/inc/func/SignatureHelper.php

xqd
@@ -0,0 +1,50 @@
+<?php
+//解密QQ:麒擎网络
+class SignatureHelper
+{
+    public function request($accessKeyId, $accessKeySecret, $domain, $params)
+    {
+        $apiParams = array_merge(array("SignatureMethod" => "HMAC-SHA1", "SignatureNonce" => uniqid(mt_rand(0, 0xffff), true), "SignatureVersion" => "1.0", "AccessKeyId" => $accessKeyId, "Timestamp" => gmdate("Y-m-d\\TH:i:s\\Z"), "Format" => "JSON"), $params);
+        ksort($apiParams);
+        $sortedQueryStringTmp = '';
+        foreach ($apiParams as $key => $value) {
+            $sortedQueryStringTmp .= "&" . $this->encode($key) . "=" . $this->encode($value);
+        }
+        $stringToSign = "GET&%2F&" . $this->encode(substr($sortedQueryStringTmp, 1));
+        $sign = base64_encode(hash_hmac("sha1", $stringToSign, $accessKeySecret . "&", true));
+        $signature = $this->encode($sign);
+        $url = "http://{$domain}/?Signature={$signature}{$sortedQueryStringTmp}";
+        try {
+            $content = $this->fetchContent($url);
+            return json_decode($content);
+        } catch (\Exception $e) {
+            return false;
+        }
+    }
+    private function encode($str)
+    {
+        $res = urlencode($str);
+        $res = preg_replace("/\\+/", "%20", $res);
+        $res = preg_replace("/\\*/", "%2A", $res);
+        $res = preg_replace("/%7E/", "~", $res);
+        return $res;
+    }
+    private function fetchContent($url)
+    {
+        if (function_exists("curl_init")) {
+            $ch = curl_init();
+            curl_setopt($ch, CURLOPT_URL, $url);
+            curl_setopt($ch, CURLOPT_TIMEOUT, 5);
+            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+            curl_setopt($ch, CURLOPT_HTTPHEADER, array("x-sdk-client" => "php/2.0.0"));
+            $rtn = curl_exec($ch);
+            if ($rtn === false) {
+                trigger_error("[CURL_" . curl_errno($ch) . "]: " . curl_error($ch), E_USER_ERROR);
+            }
+            curl_close($ch);
+            return $rtn;
+        }
+        $context = stream_context_create(array("http" => array("method" => "GET", "header" => array("x-sdk-client: php/2.0.0"))));
+        return file_get_contents($url, false, $context);
+    }
+}

+ 20 - 0
server/addons/hyb_o2o/inc/func/app_menu.php

xqd
@@ -0,0 +1,20 @@
+<?php
+
+defined('IN_IA') or exit('Access Denied');
+$navemenu[14] = array('title' => '<a href="' . $web_url . '?c=site&a=entry&op=display&do=peiz&m=hyb_o2o" class="panel-title wytitle" id="yframe-14"><icon class="fa" style="margin-right:5px;"><img  src="/addons/hyb_o2o/template/icon/008.png"/></icon>系统设置</a>', 'items' => array(
+    0 => $this->createMainMenu('小程序配置', $do, 'peiz', ''),
+    1 => $this->createMainMenu('提现配置', $do, 'pay', ''),
+    2 => $this->createMainMenu('小程序模板消息', $do, 'template', ''),
+    3 => $this->createMainMenu('短信通知', $do, 'new', ''),
+    4 => $this->createMainMenu('基本设置', $do, 'base', ''),
+    5 => $this->createMainMenu('多城市设置', $do, 'city', ''),
+    6 => $this->createMainMenu('模块存储', $do, 'cunchu', ''),
+    7 => $this->createMainMenu('常见问题', $do, 'questions', ''),
+    //11 => $this->createMainMenu('入口', $do, 'questions', ''),
+    // 8 => $this->createMainMenu('公众号支付配置', $do, 'pay_set', ''),
+    8 => $this->createMainMenu('公众号模板消息', $do, 'template_wx', ''),
+    9 => $this->createMainMenu('公告设置', $do, 'gonggao', ''),
+    10 => $this->createMainMenu('抽成规则', $do, 'takebase', ''),
+    11 => $this->createMainMenu('显示设置', $do, 'displayshezhi', ''),
+    12 => $this->createMainMenu('小程序页面', $do, 'smallprogram', ''),
+));

+ 185 - 0
server/addons/hyb_o2o/inc/func/core.php

xqd
@@ -0,0 +1,185 @@
+<?php
+//解密QQ:麒擎网络
+defined("IN_IA") or exit("Access Denied");
+class Core extends WeModuleSite
+{
+    public function getMainMenu()
+    {
+        global $_W, $_GPC;
+        $base = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_base") . " where uniacid=:uniacid", array(":uniacid" => $_W["uniacid"]));
+        $_W["pt_type"] = $base["pt_type"];
+        $do = $_GPC["do"];
+        if (IS_DAILI === "1") {
+            $web_url = "daili.php";
+        } else {
+            $web_url = "index.php";
+        }
+        $navemenu = array();
+        $cur_color = " style=\"color:#d9534f;\" ";
+        if ($_W["isfounder"] || $_W["role"] == "manager" || $_W["role"] == "operator") {
+            $navemenu[0] = array("title" => "<a href=\"" . $web_url . "?c=site&a=entry&op=display&do=gaikuangdata&m=hyb_o2o\" class=\"panel-title wytitle\" id=\"yframe-0\"><icon style=\"color:#8d8d8d;\" class=\"fa\"><img src=\"/addons/hyb_o2o/template/icon/003.png\"></img></icon>  平台自营</a>", "items" => array(0 => $this->createMainMenu("数据概况", $do, "gaikuangdata", ''), 1 => $this->createMainMenu("自营信息设置", $do, "store", ''), 2 => $this->createMainMenu("平台账号", $do, "account", ''), 3 => $this->createMainMenu("自营员工管理", $do, "storeyuangong", '')));
+            $navemenu[1] = array("title" => "<a href=\"" . $web_url . "?c=site&a=entry&op=display&do=goods&m=hyb_o2o\" class=\"panel-title wytitle\" id=\"yframe-1\"><icon style=\"color:#8d8d8d;\" class=\"fa\"><img src=\"/addons/hyb_o2o/template/icon/001.png\"></img></icon>  商品管理</a>", "items" => array(0 => $this->createMainMenu("商品列表 ", $do, "goods", ''), 1 => $this->createMainMenu("商品分类", $do, "goodsstyle", ''), 2 => $this->createMainMenu("商品保障列表", $do, "goods_baozhang", '')));
+            $navemenu[2] = array("title" => "<a href=\"" . $web_url . "?c=site&a=entry&op=displays&do=fuwu&m=hyb_o2o\" class=\"panel-title wytitle\" id=\"yframe-2\"><icon style=\"color:#8d8d8d;\" class=\"fa\"><img src=\"/addons/hyb_o2o/template/icon/002.png\"></img></icon>  服务管理</a>", "items" => array(0 => $this->createMainMenu("服务列表 ", $do, "fuwu", ''), 1 => $this->createMainMenu("服务分类 ", $do, "fuwutype", ''), 2 => $this->createMainMenu("订购须知 ", $do, "fuwu_dinggou", '')));
+            $navemenu[3] = array("title" => "<a href=\"" . $web_url . "?c=site&a=entry&op=display&do=shangjia&m=hyb_o2o\" class=\"panel-title wytitle\" id=\"yframe-3\"><icon style=\"color:#8d8d8d;\" class=\"fa\"><img src=\"/addons/hyb_o2o/template/icon/015.png\"></img></icon>  商家管理</a>", "items" => array(0 => $this->createMainMenu("商家列表 ", $do, "shangjia", ''), 1 => $this->createMainMenu("商家入驻 ", $do, "shangjiaruzhu", ''), 2 => $this->createMainMenu("商家入驻明细", $do, "shangjiaruzhumingxi", ''), 3 => $this->createMainMenu("商家手册", $do, "shangjia_shouce"), 4 => $this->createMainMenu("商家手册分类", $do, "shangjia_shouce_type")));
+            $navemenu[4] = array("title" => "<a href=\"" . $web_url . "?c=site&a=entry&op=display&do=user&m=hyb_o2o\" class=\"panel-title wytitle\" id=\"yframe-4\"><icon style=\"color:#8d8d8d;\" class=\"fa\"><img src=\"/addons/hyb_o2o/template/icon/014.png\"></img></icon>  会员管理</a>", "items" => array(0 => $this->createMainMenu("会员列表 ", $do, "user", ''), 1 => $this->createMainMenu("会员卡 ", $do, "usertype", '', "type"), 2 => $this->createMainMenu("余额明细 ", $do, "userchongzhi", ''), 3 => $this->createMainMenu("积分明细", $do, "user_jifen_log", ''), 4 => $this->createMainMenu("会员卡购买记录", $do, "huiyuan_history", '')));
+            if ($_W["pt_type"] == 1) {
+                $navemenu[5] = array("title" => "<a href=\"" . $web_url . "?c=site&a=entry&op=display&do=ordergoods&m=hyb_o2o\" class=\"panel-title wytitle\" id=\"yframe-5\"><icon style=\"color:#8d8d8d;\" class=\"fa\"><img src=\"/addons/hyb_o2o/template/icon/013.png\"></img></icon>  订单管理</a>", "items" => array(0 => $this->createMainMenu("商品订单 ", $do, "ordergoods", ''), 2 => $this->createMainMenu("商家服务订单", $do, "ordermdfw", ''), 3 => $this->createMainMenu("积分兑换订单", $do, "orderjifen", ''), 4 => $this->createMainMenu("技师预约订单", $do, "orderjishi", ''), 5 => $this->createMainMenu("服务评价", $do, "pingjia", ''), 7 => $this->createMainMenu("技师评价", $do, "pingjiagoods", ''), 9 => $this->createMainMenu("订单处理规则", $do, "orderbase", '')));
+            } else {
+                $navemenu[5] = array("title" => "<a href=\"" . $web_url . "?c=site&a=entry&op=display&do=ordergoods&m=hyb_o2o\" class=\"panel-title wytitle\" id=\"yframe-5\"><icon style=\"color:#8d8d8d;\" class=\"fa \"><img src=\"/addons/hyb_o2o/template/icon/013.png\"></img></icon>  订单管理</a>", "items" => array(0 => $this->createMainMenu("商品订单 ", $do, "ordergoods", ''), 1 => $this->createMainMenu("平台服务订单 ", $do, "ordermdfw", ''), 2 => $this->createMainMenu("商家服务订单", $do, "ordersjfw", ''), 3 => $this->createMainMenu("积分兑换订单", $do, "orderjifen", ''), 4 => $this->createMainMenu("技师预约订单", $do, "orderjishi", ''), 5 => $this->createMainMenu("服务评价", $do, "pingjia", ''), 7 => $this->createMainMenu("技师评价", $do, "pingjiajishi", ''), 10 => $this->createMainMenu("发单评价", $do, "pingjiafadan", ''), 9 => $this->createMainMenu("订单处理规则", $do, "orderbase", '')));
+            }
+            $navemenu[6] = array("title" => "<a href=\"" . $web_url . "?c=site&a=entry&op=display&do=tixian&m=hyb_o2o\" class=\"panel-title wytitle\" id=\"yframe-6\"><icon style=\"color:#8d8d8d;\" class=\"fa\"><img src=\"/addons/hyb_o2o/template/icon/012.png\"></img></icon>  提现中心</a>", "items" => array(0 => $this->createMainMenu("提现列表 ", $do, "tixian", ''), 1 => $this->createMainMenu("提现明细 ", $do, "tixian_log", ''), 2 => $this->createMainMenu("提现规则 ", $do, "tixian_gzmenu", '')));
+            if ($_W["pt_type"] == 2 || $_W["pt_type"] == 4 || $_W["pt_type"] == 5) {
+                return false;
+            }
+            $navemenu[7] = array("title" => "<a href=\"" . $web_url . "?c=site&a=entry&op=display&do=qiangdan&m=hyb_o2o\" class=\"panel-title wytitle\" id=\"yframe-7\"><icon style=\"color:#8d8d8d;\" class=\"fa\"><img src=\"/addons/hyb_o2o/template/icon/012.png\"></img></icon>  抢单中心</a>", "items" => array(0 => $this->createMainMenu("派单列表 ", $do, "qiangdan", ''), 2 => $this->createMainMenu("抢单规则 ", $do, "qiangdan_guizhe", '')));
+            $navemenu[8] = array("title" => "<a href=\"" . $web_url . "?c=site&a=entry&op=display&do=jfgoods&m=hyb_o2o\" class=\"panel-title wytitle\" id=\"yframe-8\"><icon style=\"color:#8d8d8d;\" class=\"fa\"><img src=\"/addons/hyb_o2o/template/icon/004.png\"></img></icon> 积分商城</a>", "items" => array(0 => $this->createMainMenu("商品列表", $do, "jfgoods", ''), 1 => $this->createMainMenu("积分幻灯片", $do, "jfthumb", ''), 2 => $this->createMainMenu("导航分类", $do, "jftype", ''), 3 => $this->createMainMenu("积分规则", $do, "yinxiaobase", '')));
+            // $navemenu[9] = array("title" => "<a href=\"" . $web_url . "?c=site&a=entry&op=display&do=fxlist&m=hyb_o2o\" class=\"panel-title wytitle\" id=\"yframe-9\"><icon style=\"color:#8d8d8d;\" class=\"fa\"><img src=\"/addons/hyb_o2o/template/icon/004.png\"></img></icon> 分销中心</a>", "items" => array(0 => $this->createMainMenu("分销商管理", $do, "fxlist", ''), 1 => $this->createMainMenu("分销设置", $do, "fxset", ''), 2 => $this->createMainMenu("提现申请", $do, "fxtx", ''), 3 => $this->createMainMenu("分销订单", $do, "fxorder", '')));
+            $navemenu[10] = array("title" => "<a href=\"" . $web_url . "?c=site&a=entry&op=display&do=youhuiquan&m=hyb_o2o\" class=\"panel-title wytitle\" id=\"yframe-10\"><icon style=\"color:#8d8d8d;\" class=\"fa\"><img src=\"/addons/hyb_o2o/template/icon/011.png\"></img></icon> 营销设置</a>", "items" => array(0 => $this->createMainMenu("优惠券", $do, "youhuiquan", ''), 2 => $this->createMainMenu("新人红包设置", $do, "hongbao", '')));
+            $navemenu[11] = array("title" => "<a href=\"" . $web_url . "?c=site&a=entry&op=display&do=shangjiabzjshezhi&m=hyb_o2o\" class=\"panel-title wytitle\" id=\"yframe-11\"><icon style=\"color:#8d8d8d;\" class=\"fa\"><img src=\"/addons/hyb_o2o/template/icon/005.png\"></img></icon>保证金管理</a>", "items" => array(3 => $this->createMainMenu("保证金权益 ", $do, "shangjiabzjshezhi", ''), 4 => $this->createMainMenu("保证金规则", $do, "shangjiabzjguize", ''), 5 => $this->createMainMenu("保证金明细", $do, "shangjiabzjmingxi", ''), 6 => $this->createMainMenu("保证金申退", $do, "shangjiabzjshentui", '')));
+            $navemenu[13] = array("title" => "<a href=\"" . $web_url . "?c=site&a=entry&op=display&do=daili&m=hyb_o2o\" class=\"panel-title wytitle\" id=\"yframe-13\"><icon style=\"color:#8d8d8d;\" class=\"fa\"><img src=\"/addons/hyb_o2o/template/icon/005.png\"></img></icon>代理商管理</a>", "items" => array(1 => $this->createMainMenu("代理商管理 ", $do, "daili", ''), 2 => $this->createMainMenu("代理商结算", $do, "daili_jiesuan", ''), 3 => $this->createMainMenu("代理商结算规则", $do, "daili_jiesuanguize", ''), 4 => $this->createMainMenu("结算明细", $do, "daili_mingxi", '')));
+            $navemenu[19] = array("title" => "<a href=\"" . $web_url . "?c=site&a=entry&op=display&do=article&m=hyb_o2o\" class=\"panel-title wytitle\" id=\"yframe-19\"><icon style=\"color:#8d8d8d;\" class=\"fa\"><img src=\"/addons/hyb_o2o/template/icon/005.png\"></img></icon> 资讯列表</a>", "items" => array(1 => $this->createMainMenu("资讯列表", $do, "article", ''), 2 => $this->createMainMenu("资讯分类", $do, "article_type", ''), 3 => $this->createMainMenu("资讯评价", $do, "article_pingjia", '')));
+            $navemenu[12] = array("title" => "<a href=\"" . $web_url . "?c=site&a=entry&op=display&do=storejishi&m=hyb_o2o\" class=\"panel-title wytitle\" id=\"yframe-12\"><icon style=\"color:#8d8d8d;\" class=\"fa\"><img src=\"/addons/hyb_o2o/template/icon/005.png\"></img></icon> 技师中心</a>", "items" => array(0 => $this->createMainMenu("技师列表", $do, "storejishi", ''), 1 => $this->createMainMenu("技师入驻设置", $do, "storejishirz", ''), 2 => $this->createMainMenu("技师排行", $do, "jishi_paihang", ''), 6 => $this->createMainMenu("技师入驻明细", $do, "jishi_ruzhumingxi", ''), 7 => $this->createMainMenu("技师手册", $do, "jishi_shouce", ''), 8 => $this->createMainMenu("技师手册分类", $do, "jishi_shouce_type", '')));
+//            @(include "daili_menu.php");
+            $navemenu[14] = array("title" => "<a href=\"" . $web_url . "?c=site&a=entry&op=display&do=peiz&m=hyb_o2o\" class=\"panel-title wytitle\" id=\"yframe-14\"><icon style=\"color:#8d8d8d;\" class=\"fa\"><img class=\"fa\" src=\"/addons/hyb_o2o/template/icon/008.png\"/></icon>系统设置</a>", "items" => array(0 => $this->createMainMenu("小程序配置", $do, "peiz", ''), 1 => $this->createMainMenu("提现配置", $do, "pay", ''), 2 => $this->createMainMenu("小程序模板消息", $do, "template", ''),3 => $this->createMainMenu('公众号模板消息', $do, 'template_wx', ''), 4 => $this->createMainMenu("短信通知", $do, "new", ''), 5 => $this->createMainMenu("基本设置", $do, "base", ''), 6 => $this->createMainMenu("多城市设置", $do, "city", ''), 
+                // 6 => $this->createMainMenu("模块存储", $do, "cunchu", ''),
+                 7 => $this->createMainMenu("常见问题", $do, "questions", ''), 8 => $this->createMainMenu("公告设置", $do, "gonggao", ''), 9 => $this->createMainMenu("抽成规则", $do, "takebase", ''), 10 => $this->createMainMenu("小程序页面", $do, "smallprogram", ''), 11 => $this->createMainMenu("显示设置", $do, "displayshezhi", ''), 12 => $this->createMainMenu("菜单设置", $do, "menu", ''), 13 => $this->createMainMenu("首页头部菜单", $do, "menutop", '')));
+            $navemenu[15] = array("title" => "<a href=\"" . $web_url . "?c=site&a=entry&op=display&do=plugin&m=hyb_o2o\" class=\"panel-title wytitle\" id=\"yframe-15\"><icon style=\"color:#8d8d8d;\" class=\"fa\"><img src=\"/addons/hyb_o2o/template/icon/007.png\"/></icon> 应用中心</a>", "items" => array(0 => $this->createMainMenu("应用中心", $do, "plugin", ''), 2 => $this->createMainMenu("我的云端", $do, "mycloud", '')));
+            $navemenu[16] = array("title" => "<a href=\"" . $web_url . "?c=site&a=entry&op=display&do=caiwu&m=hyb_o2o\" class=\"panel-title wytitle\" id=\"yframe-16\"><icon style=\"color:#8d8d8d;\" class=\"fa\"><img src=\"/addons/hyb_o2o/template/icon/006.png\"/></icon> 财务统计</a>", "items" => array(0 => $this->createMainMenu("订单明细", $do, "caiwu", '')));
+            $navemenu[18] = array("title" => "<a href=\"" . $web_url . "?c=site&a=entry&op=display&do=qxjuese&m=hyb_o2o\" class=\"panel-title wytitle\" id=\"yframe-18\"><icon style=\"color:#8d8d8d;\" class=\"fa\"><img src=\"/addons/hyb_o2o/template/icon/007.png\"/></icon> 权限管理</a>", "items" => array(0 => $this->createMainMenu("角色管理", $do, "qxjuese", ''), 1 => $this->createMainMenu("操作员管理", $do, "qxcaozuoyuan", '')));
+        }
+        if (IS_DAILI === "1") {
+            unset($navemenu[0]["items"][1]);
+            unset($navemenu[0]["items"][2]);
+            unset($navemenu[0]["items"][3]);
+            unset($navemenu[1]);
+            unset($navemenu[2]["items"][1]);
+            unset($navemenu[3]["items"][1]);
+            unset($navemenu[3]["items"][3]);
+            unset($navemenu[3]["items"][4]);
+            unset($navemenu[3]["items"][5]);
+            unset($navemenu[3]["items"][6]);
+            unset($navemenu[4]["items"][1]);
+            unset($navemenu[5]["items"][8]);
+            unset($navemenu[5]["items"][9]);
+            unset($navemenu[6]);
+            unset($navemenu[7]["items"][2]);
+            unset($navemenu[8]);
+            unset($navemenu[9]);
+            unset($navemenu[12]["items"][1]);
+            unset($navemenu[12]["items"][3]);
+            unset($navemenu[12]["items"][5]);
+            unset($navemenu[12]["items"][7]);
+            unset($navemenu[14]);
+            unset($navemenu[15]);
+            unset($navemenu[16]);
+            unset($navemenu[17]);
+            unset($navemenu[18]);
+        }
+        $yonghu = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_perms_user") . " WHERE uniacid=:uniacid and uid=:uid and user=:user", array(":uniacid" => $_W["uniacid"], ":uid" => $_W["uid"], ":user" => $_W["username"]));
+        if (!empty($yonghu)) {
+            $quanxian = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_perms") . " WHERE uniacid=:uniacid and id=:id", array(":uniacid" => $_W["uniacid"], ":id" => $yonghu["juese"]));
+            $quanxian["perms"] = unserialize($quanxian["perms"]);
+            foreach ($navemenu as $key => $value) {
+                $a = false;
+                foreach ($quanxian["perms"] as $k => $val) {
+                    if (strpos($value["title"], $val) !== false) {
+                        $a = true;
+                    }
+                }
+                if (!$a) {
+                    unset($navemenu[$key]);
+                }
+            }
+        }
+        return $navemenu;
+    }
+    function createMainMenu($title, $do, $method, $icon = "fa-image", $op = "display", $color = '')
+    {
+        $color = " style=\"color:" . $color . ";\" ";
+        return array("title" => $title, "url" => $this->createWebUrl($method, array("op" => $op)), "active" => $do == $method ? " active" : '', "append" => array("title" => "<i " . $color . " class=\"fa fa-angle-right\"></i>"));
+    }
+    function createMainMenu2($title, $do, $method, $op = "1")
+    {
+        $color = " style=\"color:" . $color . ";\" ";
+        return array("title" => $title, "url" => $this->createWebUrl($method, array("op" => $op)), "active" => $do == $method ? " active" : '', "append" => array("title" => "<i " . $color . " class=\"fa fa-angle-right\"></i>"));
+    }
+    public function createWebUrl($do, $query = array())
+    {
+        $query["do"] = $do;
+        $query["m"] = strtolower($this->modulename);
+        $segment = "site/entry";
+        $params = $query;
+        list($controller, $action, $do) = explode("/", $segment);
+        if (IS_DAILI === "1") {
+            $url = "./daili.php?";
+        } else {
+            $url = "./index.php?";
+        }
+        if (!empty($controller)) {
+            $url .= "c={$controller}&";
+        }
+        if (!empty($action)) {
+            $url .= "a={$action}&";
+        }
+        if (!empty($do)) {
+            $url .= "do={$do}&";
+        }
+        if (!empty($params)) {
+            $queryString = http_build_query($params, '', "&");
+            $url .= $queryString;
+        }
+        return $url;
+    }
+    public function getNaveMenu($action, $uniacid, $storeid)
+    {
+        global $_W, $_GPC;
+        $do = $_GPC["do"];
+        $navemenu = array();
+        $cur_color = "#8d8d8d";
+        $navemenu[0] = array("title" => "<a href=\"o2ostore.php?c=site&a=entry&op=display&do=start&m=hyb_o2o&uid=" . $uniacid . "&id=" . $storeid . "\" class=\"panel-title wytitle\" id=\"yframe-0\"><icon style=\"color:#8d8d8d;\" class=\"fa fa-cog\"></icon>  平台设置</a>", "items" => array(0 => $this->createSubMenu("数据概况", $do, "start", "fa-angle-right", $cur_color, $uniacid, $storeid), 1 => $this->createSubMenu("平台信息 ", $do, "dlstoreinfo", "fa-angle-right", $cur_color, $uniacid, $storeid), 2 => $this->createSubMenu("平台员工 ", $do, "dlistoreyuangong", "fa-angle-right", $cur_color, $uniacid, $storeid), 3 => $this->createSubMenu("修改密码 ", $do, "edit_pass", "fa-angle-right", $cur_color, $uniacid, $storeid)), "icon" => "fa fa-user-md");
+        $cur_color = "#8d8d8d";
+        $navemenu[1] = array("title" => "<a href=\"o2ostore.php?c=site&a=entry&op=display&do=dlfuwu&m=hyb_o2o&uid=" . $uniacid . "&id=" . $storeid . "\" class=\"panel-title wytitle\" id=\"yframe-1\"><icon style=\"color:" . $cur_color . ";\" class=\"fa fa-university\"></icon>  服务管理</a>", "items" => array(0 => $this->createSubMenu("服务列表 ", $do, "dlfuwu", "fa-angle-right", $cur_color, $uniacid, $storeid)));
+        $navemenu[2] = array("title" => "<a href=\"o2ostore.php?c=site&a=entry&op=display&do=dlordersm&m=hyb_o2o&uid=" . $uniacid . "&id=" . $storeid . "\" class=\"panel-title wytitle\" id=\"yframe-2\"><icon style=\"color:" . $cur_color . ";\" class=\"fa fa-bars\"></icon>  订单管理</a>", "items" => array(0 => $this->createSubMenu("上门服务订单 ", $do, "dlordersm", "fa-angle-right", $cur_color, $uniacid, $storeid), 1 => $this->createSubMenu("到店服务订单 ", $do, "dlorderdd", "fa-angle-right", $cur_color, $uniacid, $storeid)));
+        $navemenu[3] = array("title" => "<a href=\"o2ostore.php?c=site&a=entry&op=daijiedan&do=dlpaidan&m=hyb_o2o&uid=" . $uniacid . "&id=" . $storeid . "\" class=\"panel-title wytitle\" id=\"yframe-3\"><icon style=\"color:" . $cur_color . ";\" class=\"fa fa-bars\"></icon>  派单中心</a>", "items" => array(0 => $this->createSubMenu("派单列表 ", $do, "dlpaidan", "fa-angle-right", $cur_color, $uniacid, $storeid)));
+        $cur_color = "#8d8d8d";
+        $navemenu[4] = array("title" => "<a href=\"o2ostore.php?c=site&a=entry&op=display&do=dlyingxiaoyhq&m=hyb_o2o&uid=" . $uniacid . "&id=" . $storeid . "\" class=\"panel-title wytitle\" id=\"yframe-4\"><icon style=\"color:" . $cur_color . ";\" class=\"fa fa-gift\"></icon>  营销设置</a>", "items" => array(0 => $this->createSubMenu("优惠券 ", $do, "dlyingxiaoyhq", "fa-angle-right", $cur_color, $uniacid, $storeid), 1 => $this->createSubMenu("次卡服务", $do, "dlyingxiaocika", "fa-angle-right", $cur_color, $uniacid, $storeid)));
+        $cur_color = "#8d8d8d";
+        $navemenu[5] = array("title" => "<a href=\"o2ostore.php?c=site&a=entry&type=wait&do=dltixian&m=hyb_o2o&uid=" . $uniacid . "&id=" . $storeid . "\" class=\"panel-title wytitle\" id=\"yframe-5\"><icon style=\"color:" . $cur_color . ";\" class=\"fa fa-money\"></icon>  提现管理</a>", "items" => array(0 => $this->createSubMenu("提现列表", $do, "dltixian", "fa-angle-right", $cur_color, $uniacid, $storeid)));
+        $cur_color = "#8d8d8d";
+        $navemenu[6] = array("title" => "<a href=\"o2ostore.php?c=site&a=entry&op=display&do=dlpingjia&m=hyb_o2o&uid=" . $uniacid . "&id=" . $storeid . "\" class=\"panel-title wytitle\" id=\"yframe-6\"><icon style=\"color:" . $cur_color . ";\" class=\"fa fa-comments\"></icon>  评论管理</a>", "items" => array(0 => $this->createSubMenu("评论管理 ", $do, "dlpingjia", "fa-angle-right", $cur_color, $uniacid, $storeid)));
+        $cur_color = "#8d8d8d";
+        $navemenu[7] = array("title" => "<a href=\"o2ostore.php?c=site&a=entry&op=display&do=pt_jiesuan&m=hyb_o2o&uid=" . $uniacid . "&id=" . $storeid . "\" class=\"panel-title wytitle\" id=\"yframe-7\"><icon style=\"color:" . $cur_color . ";\" class=\"fa fa-comments\"></icon>  平台结算</a>", "items" => array(0 => $this->createSubMenu("平台结算 ", $do, "pt_jiesuan", "fa-angle-right", $cur_color, $uniacid, $storeid)));
+        return $navemenu;
+    }
+    function createSubMenu($title, $do, $method, $icon = "fa-image", $color = "#d9534f", $uniacid, $storeid)
+    {
+        $color = " style=\"color:" . $color . ";\" ";
+        $url = $this->createWebUrl2($method, array("op" => "display", "uid" => $uniacid, "id" => $storeid));
+        return array("title" => $title, "url" => $do != $method ? $url : '', "active" => $do == $method ? " active" : '', "append" => array("title" => "<i class=\"fa " . $icon . "\"></i>"));
+    }
+    function createWebUrl2($do, $query = array())
+    {
+        $query["do"] = $do;
+        $query["m"] = strtolower($this->modulename);
+        return $this->wurl("site/entry", $query);
+    }
+    function wurl($segment, $params = array())
+    {
+        list($controller, $action, $do) = explode("/", $segment);
+        $url = "./o2ostore.php?";
+        if (!empty($controller)) {
+            $url .= "c={$controller}&";
+        }
+        if (!empty($action)) {
+            $url .= "a={$action}&";
+        }
+        if (!empty($do)) {
+            $url .= "do={$do}&";
+        }
+        if (!empty($params)) {
+            $queryString = http_build_query($params, '', "&");
+            $url .= $queryString;
+        }
+        return $url;
+    }
+}

+ 172 - 0
server/addons/hyb_o2o/inc/func/functions.php

xqd
@@ -0,0 +1,172 @@
+<?php
+//解密QQ:麒擎网络
+if (!defined("IN_IA")) {
+    exit("Access Denied");
+}
+if (!function_exists("m")) {
+    function m($name = '')
+    {
+        static $_modules = array();
+        if (isset($_modules[$name])) {
+            return $_modules[$name];
+        }
+        $model = IA_ROOT . "/addons/hyb_o2o/inc/model/" . strtolower($name) . ".php";
+        if (!is_file($model)) {
+            die(" Model " . $name . " Not Found!");
+        }
+        require_once $model;
+        $class_name = ucfirst($name) . "_Model";
+        $_modules[$name] = new $class_name();
+        return $_modules[$name];
+    }
+}
+if (!function_exists("get_distance")) {
+    function get_distance($lat1, $lng1, $lat2, $lng2)
+    {
+        $earthRadius = 6378137;
+        $EARTH_RADIUS = 6378137;
+        $RAD = pi() / 180.0;
+        $radLat1 = $lat1 * $RAD;
+        $radLat2 = $lat2 * $RAD;
+        $a = $radLat1 - $radLat2;
+        $b = ($lng1 - $lng2) * $RAD;
+        $s = 2 * asin(sqrt(pow(sin($a / 2), 2) + cos($radLat1) * cos($radLat2) * pow(sin($b / 2), 2)));
+        $s = $s * $EARTH_RADIUS;
+        return $s = round($s * 10000) / 10000;
+    }
+}
+if (!function_exists("arraySequence")) {
+    function arraySequence($array, $field, $sort = "SORT_DESC")
+    {
+        $arrSort = array();
+        foreach ($array as $uniqid => $row) {
+            foreach ($row as $key => $value) {
+                $arrSort[$key][$uniqid] = $value;
+            }
+        }
+        array_multisort($arrSort[$field], constant($sort), $array);
+        return $array;
+    }
+}
+if (!function_exists("output_data")) {
+    function output_data($datas, $extend_data = array(), $error = false)
+    {
+        $data = array();
+        $data["code"] = 200;
+        if ($error) {
+            $data["code"] = 400;
+        }
+        if (!empty($extend_data)) {
+            $data = array_merge($data, $extend_data);
+        }
+        $data["datas"] = $datas;
+        header("Content-type: application/json; charset=utf-8");
+        if (!empty($_GET["callback"])) {
+            echo $_GET["callback"] . "(" . json_encode($data, $jsonFlag) . ")";
+            die;
+        } else {
+            header("Access-Control-Allow-Origin:*");
+            echo json_encode($data, $jsonFlag);
+            die;
+        }
+    }
+}
+if (!function_exists("output_error")) {
+    function output_error($message, $extend_data = array())
+    {
+        $datas = array("error" => $message);
+        output_data($datas, $extend_data, true);
+    }
+}
+if (!function_exists("setMyCookie")) {
+    function setMyCookie($name, $value, $expire = "3600", $path = '', $domain = '', $secure = false)
+    {
+        if (empty($path)) {
+            $path = "/";
+        }
+        if (empty($domain)) {
+            $domain = SUBDOMAIN_SUFFIX ? SUBDOMAIN_SUFFIX : '';
+        }
+        $expire = intval($expire) ? intval($expire) : (intval(SESSION_EXPIRE) ? intval(SESSION_EXPIRE) : 3600);
+        $result = setcookie($name, $value, time() + $expire, $path, $domain, $secure);
+        $_COOKIE[$name] = $value;
+    }
+}
+if (!function_exists("down_remote_file")) {
+    function down_remote_file($url, $save_dir = '', $filename = '', $type = 1)
+    {
+        if (trim($url) == '') {
+            return array("file_name" => '', "save_path" => '', "error" => 1);
+        }
+        if (trim($save_dir) == '') {
+            $save_dir = "./";
+        }
+        if (trim($filename) == '') {
+            $ext = strrchr($url, ".");
+            $filename = time() . $ext;
+        }
+        if (0 !== strrpos($save_dir, "/")) {
+            $save_dir .= "/";
+        }
+        if (!file_exists($save_dir) && !mkdir($save_dir, 0777, true)) {
+            return array("file_name" => '', "save_path" => '', "error" => 5);
+        }
+        if ($type) {
+            $ch = curl_init();
+            $timeout = 100;
+            curl_setopt($ch, CURLOPT_URL, $url);
+            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
+            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
+            $img = curl_exec($ch);
+            curl_close($ch);
+        } else {
+            ob_start();
+            @readfile($url);
+            $img = ob_get_contents();
+            ob_end_clean();
+        }
+        $fp2 = fopen($save_dir . $filename, "w");
+        fwrite($fp2, $img);
+        fclose($fp2);
+        unset($img, $url);
+        return array("file_name" => $filename, "save_path" => $save_dir . $filename, "error" => 0);
+    }
+}
+if (!function_exists("get_zip_originalsize")) {
+    function get_zip_originalsize($filename, $path)
+    {
+        if (!file_exists($filename)) {
+            return false;
+        }
+        $starttime = explode(" ", microtime());
+        $filename = iconv("utf-8", "gb2312", $filename);
+        $path = iconv("utf-8", "gb2312", $path);
+        $resource = zip_open($filename);
+        $i = 1;
+        while ($dir_resource = zip_read($resource)) {
+            if (zip_entry_open($resource, $dir_resource)) {
+                $file_name = $path . zip_entry_name($dir_resource);
+                $file_path = substr($file_name, 0, strrpos($file_name, "/"));
+                if (!is_dir($file_path)) {
+                    mkdir($file_path, 0777, true);
+                }
+                if (!is_dir($file_name)) {
+                    $file_size = zip_entry_filesize($dir_resource);
+                    if (!($file_size < 1024 * 1024 * 30)) {
+                        echo "<p> " . $i++ . " 此文件已被跳过,原因:文件过大, -> " . iconv("gb2312", "utf-8", $file_name) . " </p>";
+                    } else {
+                        $file_content = zip_entry_read($dir_resource, $file_size);
+                        file_put_contents($file_name, $file_content);
+                    }
+                }
+                zip_entry_close($dir_resource);
+            }
+        }
+        zip_close($resource);
+        $endtime = explode(" ", microtime());
+        $thistime = $endtime[0] + $endtime[1] - ($starttime[0] + $starttime[1]);
+        $thistime = round($thistime, 3);
+        return true;
+    }
+}

+ 376 - 0
server/addons/hyb_o2o/inc/lib/WxPay.Api.php

xqd
@@ -0,0 +1,376 @@
+<?php
+//解密QQ:麒擎网络
+require_once "WxPay.Exception.php";
+require_once "WxPay.Config.Interface.php";
+require_once "WxPay.Data.php";
+class WxPayApi
+{
+    public static function unifiedOrder($config, $inputObj, $timeOut = 6)
+    {
+        $url = "https://api.mch.weixin.qq.com/pay/unifiedorder";
+        if (!$inputObj->IsOut_trade_noSet()) {
+            throw new WxPayException("缺少统一支付接口必填参数out_trade_no!");
+        } else {
+            if (!$inputObj->IsBodySet()) {
+                throw new WxPayException("缺少统一支付接口必填参数body!");
+            } else {
+                if (!$inputObj->IsTotal_feeSet()) {
+                    throw new WxPayException("缺少统一支付接口必填参数total_fee!");
+                } else {
+                    if (!$inputObj->IsTrade_typeSet()) {
+                        throw new WxPayException("缺少统一支付接口必填参数trade_type!");
+                    }
+                }
+            }
+        }
+        if ($inputObj->GetTrade_type() == "JSAPI" && !$inputObj->IsOpenidSet()) {
+            throw new WxPayException("统一支付接口中,缺少必填参数openid!trade_type为JSAPI时,openid为必填参数!");
+        }
+        if ($inputObj->GetTrade_type() == "NATIVE" && !$inputObj->IsProduct_idSet()) {
+            throw new WxPayException("统一支付接口中,缺少必填参数product_id!trade_type为JSAPI时,product_id为必填参数!");
+        }
+        if (!$inputObj->IsNotify_urlSet() && $config->GetNotifyUrl() != '') {
+            $inputObj->SetNotify_url($config->GetNotifyUrl());
+        }
+        $inputObj->SetAppid($config->GetAppId());
+        $inputObj->SetMch_id($config->GetMerchantId());
+        $inputObj->SetSpbill_create_ip($_SERVER["REMOTE_ADDR"]);
+        $inputObj->SetNonce_str(self::getNonceStr());
+        $inputObj->SetSign($config);
+        $xml = $inputObj->ToXml();
+        $startTimeStamp = self::getMillisecond();
+        $response = self::postXmlCurl($config, $xml, $url, false, $timeOut);
+        $result = WxPayResults::Init($config, $response);
+        self::reportCostTime($config, $url, $startTimeStamp, $result);
+        return $result;
+    }
+    public static function orderQuery($config, $inputObj, $timeOut = 6)
+    {
+        $url = "https://api.mch.weixin.qq.com/pay/orderquery";
+        if (!$inputObj->IsOut_trade_noSet() && !$inputObj->IsTransaction_idSet()) {
+            throw new WxPayException("订单查询接口中,out_trade_no、transaction_id至少填一个!");
+        }
+        $inputObj->SetAppid($config->GetAppId());
+        $inputObj->SetMch_id($config->GetMerchantId());
+        $inputObj->SetNonce_str(self::getNonceStr());
+        $inputObj->SetSign($config);
+        $xml = $inputObj->ToXml();
+        $startTimeStamp = self::getMillisecond();
+        $response = self::postXmlCurl($config, $xml, $url, false, $timeOut);
+        $result = WxPayResults::Init($config, $response);
+        self::reportCostTime($config, $url, $startTimeStamp, $result);
+        return $result;
+    }
+    public static function closeOrder($config, $inputObj, $timeOut = 6)
+    {
+        $url = "https://api.mch.weixin.qq.com/pay/closeorder";
+        if (!$inputObj->IsOut_trade_noSet()) {
+            throw new WxPayException("订单查询接口中,out_trade_no必填!");
+        }
+        $inputObj->SetAppid($config->GetAppId());
+        $inputObj->SetMch_id($config->GetMerchantId());
+        $inputObj->SetNonce_str(self::getNonceStr());
+        $inputObj->SetSign($config);
+        $xml = $inputObj->ToXml();
+        $startTimeStamp = self::getMillisecond();
+        $response = self::postXmlCurl($config, $xml, $url, false, $timeOut);
+        $result = WxPayResults::Init($config, $response);
+        self::reportCostTime($config, $url, $startTimeStamp, $result);
+        return $result;
+    }
+    public static function refund($config, $inputObj, $timeOut = 6)
+    {
+        $url = "https://api.mch.weixin.qq.com/secapi/pay/refund";
+        if (!$inputObj->IsOut_trade_noSet() && !$inputObj->IsTransaction_idSet()) {
+            throw new WxPayException("退款申请接口中,out_trade_no、transaction_id至少填一个!");
+        } else {
+            if (!$inputObj->IsOut_refund_noSet()) {
+                throw new WxPayException("退款申请接口中,缺少必填参数out_refund_no!");
+            } else {
+                if (!$inputObj->IsTotal_feeSet()) {
+                    throw new WxPayException("退款申请接口中,缺少必填参数total_fee!");
+                } else {
+                    if (!$inputObj->IsRefund_feeSet()) {
+                        throw new WxPayException("退款申请接口中,缺少必填参数refund_fee!");
+                    } else {
+                        if (!$inputObj->IsOp_user_idSet()) {
+                            throw new WxPayException("退款申请接口中,缺少必填参数op_user_id!");
+                        }
+                    }
+                }
+            }
+        }
+        $inputObj->SetAppid($config->GetAppId());
+        $inputObj->SetMch_id($config->GetMerchantId());
+        $inputObj->SetNonce_str(self::getNonceStr());
+        $inputObj->SetSign($config);
+        $xml = $inputObj->ToXml();
+        $startTimeStamp = self::getMillisecond();
+        $response = self::postXmlCurl($config, $xml, $url, true, $timeOut);
+        $result = WxPayResults::Init($config, $response);
+        self::reportCostTime($config, $url, $startTimeStamp, $result);
+        return $result;
+    }
+    public static function refundQuery($config, $inputObj, $timeOut = 6)
+    {
+        $url = "https://api.mch.weixin.qq.com/pay/refundquery";
+        if (!$inputObj->IsOut_refund_noSet() && !$inputObj->IsOut_trade_noSet() && !$inputObj->IsTransaction_idSet() && !$inputObj->IsRefund_idSet()) {
+            throw new WxPayException("退款查询接口中,out_refund_no、out_trade_no、transaction_id、refund_id四个参数必填一个!");
+        }
+        $inputObj->SetAppid($config->GetAppId());
+        $inputObj->SetMch_id($config->GetMerchantId());
+        $inputObj->SetNonce_str(self::getNonceStr());
+        $inputObj->SetSign($config);
+        $xml = $inputObj->ToXml();
+        $startTimeStamp = self::getMillisecond();
+        $response = self::postXmlCurl($config, $xml, $url, false, $timeOut);
+        $result = WxPayResults::Init($config, $response);
+        self::reportCostTime($config, $url, $startTimeStamp, $result);
+        return $result;
+    }
+    public static function downloadBill($config, $inputObj, $timeOut = 6)
+    {
+        $url = "https://api.mch.weixin.qq.com/pay/downloadbill";
+        if (!$inputObj->IsBill_dateSet()) {
+            throw new WxPayException("对账单接口中,缺少必填参数bill_date!");
+        }
+        $inputObj->SetAppid($config->GetAppId());
+        $inputObj->SetMch_id($config->GetMerchantId());
+        $inputObj->SetNonce_str(self::getNonceStr());
+        $inputObj->SetSign($config);
+        $xml = $inputObj->ToXml();
+        $response = self::postXmlCurl($config, $xml, $url, false, $timeOut);
+        if (substr($response, 0, 5) == "<xml>") {
+            return '';
+        }
+        return $response;
+    }
+    public static function micropay($config, $inputObj, $timeOut = 10)
+    {
+        $url = "https://api.mch.weixin.qq.com/pay/micropay";
+        if (!$inputObj->IsBodySet()) {
+            throw new WxPayException("提交被扫支付API接口中,缺少必填参数body!");
+        } else {
+            if (!$inputObj->IsOut_trade_noSet()) {
+                throw new WxPayException("提交被扫支付API接口中,缺少必填参数out_trade_no!");
+            } else {
+                if (!$inputObj->IsTotal_feeSet()) {
+                    throw new WxPayException("提交被扫支付API接口中,缺少必填参数total_fee!");
+                } else {
+                    if (!$inputObj->IsAuth_codeSet()) {
+                        throw new WxPayException("提交被扫支付API接口中,缺少必填参数auth_code!");
+                    }
+                }
+            }
+        }
+        $inputObj->SetSpbill_create_ip($_SERVER["REMOTE_ADDR"]);
+        $inputObj->SetAppid($config->GetAppId());
+        $inputObj->SetMch_id($config->GetMerchantId());
+        $inputObj->SetNonce_str(self::getNonceStr());
+        $inputObj->SetSign($config);
+        $xml = $inputObj->ToXml();
+        $startTimeStamp = self::getMillisecond();
+        $response = self::postXmlCurl($config, $xml, $url, false, $timeOut);
+        $result = WxPayResults::Init($config, $response);
+        self::reportCostTime($config, $url, $startTimeStamp, $result);
+        return $result;
+    }
+    public static function reverse($config, $inputObj, $timeOut = 6)
+    {
+        $url = "https://api.mch.weixin.qq.com/secapi/pay/reverse";
+        if (!$inputObj->IsOut_trade_noSet() && !$inputObj->IsTransaction_idSet()) {
+            throw new WxPayException("撤销订单API接口中,参数out_trade_no和transaction_id必须填写一个!");
+        }
+        $inputObj->SetAppid($config->GetAppId());
+        $inputObj->SetMch_id($config->GetMerchantId());
+        $inputObj->SetNonce_str(self::getNonceStr());
+        $inputObj->SetSign($config);
+        $xml = $inputObj->ToXml();
+        $startTimeStamp = self::getMillisecond();
+        $response = self::postXmlCurl($config, $xml, $url, true, $timeOut);
+        $result = WxPayResults::Init($config, $response);
+        self::reportCostTime($config, $url, $startTimeStamp, $result);
+        return $result;
+    }
+    public static function report($config, $inputObj, $timeOut = 1)
+    {
+        $url = "https://api.mch.weixin.qq.com/payitil/report";
+        if (!$inputObj->IsInterface_urlSet()) {
+            throw new WxPayException("接口URL,缺少必填参数interface_url!");
+        }
+        if (!$inputObj->IsReturn_codeSet()) {
+            throw new WxPayException("返回状态码,缺少必填参数return_code!");
+        }
+        if (!$inputObj->IsResult_codeSet()) {
+            throw new WxPayException("业务结果,缺少必填参数result_code!");
+        }
+        if (!$inputObj->IsUser_ipSet()) {
+            throw new WxPayException("访问接口IP,缺少必填参数user_ip!");
+        }
+        if (!$inputObj->IsExecute_time_Set()) {
+            throw new WxPayException("接口耗时,缺少必填参数execute_time_!");
+        }
+        $inputObj->SetAppid($config->GetAppId());
+        $inputObj->SetMch_id($config->GetMerchantId());
+        $inputObj->SetUser_ip($_SERVER["REMOTE_ADDR"]);
+        $inputObj->SetTime(date("YmdHis"));
+        $inputObj->SetNonce_str(self::getNonceStr());
+        $inputObj->SetSign($config);
+        $xml = $inputObj->ToXml();
+        $startTimeStamp = self::getMillisecond();
+        $response = self::postXmlCurl($config, $xml, $url, false, $timeOut);
+        return $response;
+    }
+    public static function bizpayurl($config, $inputObj, $timeOut = 6)
+    {
+        if (!$inputObj->IsProduct_idSet()) {
+            throw new WxPayException("生成二维码,缺少必填参数product_id!");
+        }
+        $inputObj->SetAppid($config->GetAppId());
+        $inputObj->SetMch_id($config->GetMerchantId());
+        $inputObj->SetTime_stamp(time());
+        $inputObj->SetNonce_str(self::getNonceStr());
+        $inputObj->SetSign($config);
+        return $inputObj->GetValues();
+    }
+    public static function shorturl($config, $inputObj, $timeOut = 6)
+    {
+        $url = "https://api.mch.weixin.qq.com/tools/shorturl";
+        if (!$inputObj->IsLong_urlSet()) {
+            throw new WxPayException("需要转换的URL,签名用原串,传输需URL encode!");
+        }
+        $inputObj->SetAppid($config->GetAppId());
+        $inputObj->SetMch_id($config->GetMerchantId());
+        $inputObj->SetNonce_str(self::getNonceStr());
+        $inputObj->SetSign($config);
+        $xml = $inputObj->ToXml();
+        $startTimeStamp = self::getMillisecond();
+        $response = self::postXmlCurl($config, $xml, $url, false, $timeOut);
+        $result = WxPayResults::Init($config, $response);
+        self::reportCostTime($config, $url, $startTimeStamp, $result);
+        return $result;
+    }
+    public static function notify($config, $callback, &$msg)
+    {
+        if (!isset($GLOBALS["HTTP_RAW_POST_DATA"])) {
+            return false;
+        }
+        try {
+            $xml = $GLOBALS["HTTP_RAW_POST_DATA"];
+            $result = WxPayNotifyResults::Init($config, $xml);
+        } catch (WxPayException $e) {
+            $msg = $e->errorMessage();
+            return false;
+        }
+        return call_user_func($callback, $result);
+    }
+    public static function getNonceStr($length = 32)
+    {
+        $chars = "abcdefghijklmnopqrstuvwxyz0123456789";
+        $str = '';
+        $i = 0;
+        while ($i < $length) {
+            $str .= substr($chars, mt_rand(0, strlen($chars) - 1), 1);
+            $i++;
+        }
+        return $str;
+    }
+    public static function replyNotify($xml)
+    {
+        echo $xml;
+    }
+    private static function reportCostTime($config, $url, $startTimeStamp, $data)
+    {
+        $reportLevenl = $config->GetReportLevenl();
+        if ($reportLevenl == 0) {
+            return;
+        }
+        if ($reportLevenl == 1 && array_key_exists("return_code", $data) && $data["return_code"] == "SUCCESS" && array_key_exists("result_code", $data) && $data["result_code"] == "SUCCESS") {
+            return;
+        }
+        $endTimeStamp = self::getMillisecond();
+        $objInput = new WxPayReport();
+        $objInput->SetInterface_url($url);
+        $objInput->SetExecute_time_($endTimeStamp - $startTimeStamp);
+        if (array_key_exists("return_code", $data)) {
+            $objInput->SetReturn_code($data["return_code"]);
+        }
+        if (array_key_exists("return_msg", $data)) {
+            $objInput->SetReturn_msg($data["return_msg"]);
+        }
+        if (array_key_exists("result_code", $data)) {
+            $objInput->SetResult_code($data["result_code"]);
+        }
+        if (array_key_exists("err_code", $data)) {
+            $objInput->SetErr_code($data["err_code"]);
+        }
+        if (array_key_exists("err_code_des", $data)) {
+            $objInput->SetErr_code_des($data["err_code_des"]);
+        }
+        if (array_key_exists("out_trade_no", $data)) {
+            $objInput->SetOut_trade_no($data["out_trade_no"]);
+        }
+        if (array_key_exists("device_info", $data)) {
+            $objInput->SetDevice_info($data["device_info"]);
+        }
+        try {
+            self::report($config, $objInput);
+        } catch (WxPayException $e) {
+        }
+    }
+    private static function postXmlCurl($config, $xml, $url, $useCert = false, $second = 30)
+    {
+        $ch = curl_init();
+        $curlVersion = curl_version();
+        $ua = "WXPaySDK/3.0.9 (" . PHP_OS . ") PHP/" . PHP_VERSION . " CURL/" . $curlVersion["version"] . " " . $config->GetMerchantId();
+        curl_setopt($ch, CURLOPT_TIMEOUT, $second);
+        $proxyHost = "0.0.0.0";
+        $proxyPort = 0;
+        $config->GetProxy($proxyHost, $proxyPort);
+        if ($proxyHost != "0.0.0.0" && $proxyPort != 0) {
+            curl_setopt($ch, CURLOPT_PROXY, $proxyHost);
+            curl_setopt($ch, CURLOPT_PROXYPORT, $proxyPort);
+        }
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
+        if (stripos($url, "https://") !== FALSE) {
+            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
+            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
+        } else {
+            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
+            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
+        }
+        curl_setopt($ch, CURLOPT_USERAGENT, $ua);
+        curl_setopt($ch, CURLOPT_HEADER, FALSE);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
+        if ($useCert == true) {
+            $sslCertPath = '';
+            $sslKeyPath = '';
+            $config->GetSSLCertPath($sslCertPath, $sslKeyPath);
+            curl_setopt($ch, CURLOPT_SSLCERTTYPE, "PEM");
+            curl_setopt($ch, CURLOPT_SSLCERT, $sslCertPath);
+            curl_setopt($ch, CURLOPT_SSLKEYTYPE, "PEM");
+            curl_setopt($ch, CURLOPT_SSLKEY, $sslKeyPath);
+        }
+        curl_setopt($ch, CURLOPT_POST, TRUE);
+        curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
+        $data = curl_exec($ch);
+        if ($data) {
+            curl_close($ch);
+            return $data;
+        } else {
+            $error = curl_errno($ch);
+            curl_close($ch);
+            throw new WxPayException("curl出错,错误码:{$error}");
+        }
+    }
+    private static function getMillisecond()
+    {
+        $time = explode(" ", microtime());
+        $time = $time[1] . $time[0] * 1000;
+        $time2 = explode(".", $time);
+        $time = $time2[0];
+        return $time;
+    }
+}

+ 14 - 0
server/addons/hyb_o2o/inc/lib/WxPay.Config.Interface.php

xqd
@@ -0,0 +1,14 @@
+<?php
+
+abstract class WxPayConfigInterface
+{
+    public abstract function GetAppId();
+    public abstract function GetMerchantId();
+    public abstract function GetNotifyUrl();
+    public abstract function GetSignType();
+    public abstract function GetProxy(&$proxyHost, &$proxyPort);
+    public abstract function GetReportLevenl();
+    public abstract function GetKey();
+    public abstract function GetAppSecret();
+    public abstract function GetSSLCertPath(&$sslCertPath, &$sslKeyPath);
+}

+ 62 - 0
server/addons/hyb_o2o/inc/lib/WxPay.Config.php

xqd
@@ -0,0 +1,62 @@
+<?php
+//解密QQ:麒擎网络
+require_once "WxPay.Config.Interface.php";
+class WxPayConfig extends WxPayConfigInterface
+{
+    protected $mchid;
+    protected $appid;
+    protected $apiKey;
+    protected $secret;
+    protected $apiclient_cert;
+    protected $keypath;
+    public function __construct()
+    {
+        global $_W;
+        $uniacid = $_W["uniacid"];
+        $info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_parment") . " WHERE uniacid=:uniacid ", array("uniacid" => $uniacid));
+        $this->mchid = $info["mchid"];
+        $this->appid = $info["pay_wx_appid"];
+        $this->apiKey = $info["wxkey"];
+        $this->secret = $info["pay_wx_appsecret"];
+        $this->apiclient_cert = $info["pay_wx_certpem"];
+        $this->keypath = $info["pay_wx_cert_key"];
+    }
+    public function GetAppId()
+    {
+        return $this->appid;
+    }
+    public function GetMerchantId()
+    {
+        return $this->mchid;
+    }
+    public function GetNotifyUrl()
+    {
+        return '';
+    }
+    public function GetSignType()
+    {
+        return "HMAC-SHA256";
+    }
+    public function GetProxy(&$proxyHost, &$proxyPort)
+    {
+        $proxyHost = "0.0.0.0";
+        $proxyPort = 0;
+    }
+    public function GetReportLevenl()
+    {
+        return 1;
+    }
+    public function GetKey()
+    {
+        return $this->apiKey;
+    }
+    public function GetAppSecret()
+    {
+        return $this->secret;
+    }
+    public function GetSSLCertPath(&$sslCertPath, &$sslKeyPath)
+    {
+        $sslCertPath = $this->apiclient_cert;
+        $sslKeyPath = $this->apiclient_cert;
+    }
+}

+ 1443 - 0
server/addons/hyb_o2o/inc/lib/WxPay.Data.php

xqd
@@ -0,0 +1,1443 @@
+<?php
+//解密QQ:麒擎网络
+require_once "WxPay.Config.Interface.php";
+require_once "WxPay.Exception.php";
+class WxPayDataBase
+{
+    protected $values = array();
+    public function SetSignType($sign_type)
+    {
+        $this->values["sign_type"] = $sign_type;
+        return $sign_type;
+    }
+    public function SetSign($config)
+    {
+        $sign = $this->MakeSign($config);
+        $this->values["sign"] = $sign;
+        return $sign;
+    }
+    public function GetSign()
+    {
+        return $this->values["sign"];
+    }
+    public function IsSignSet()
+    {
+        return array_key_exists("sign", $this->values);
+    }
+    public function ToXml()
+    {
+        if (!is_array($this->values) || count($this->values) <= 0) {
+            throw new WxPayException("数组数据异常!");
+        }
+        $xml = "<xml>";
+        foreach ($this->values as $key => $val) {
+            if (is_numeric($val)) {
+                $xml .= "<" . $key . ">" . $val . "</" . $key . ">";
+            } else {
+                $xml .= "<" . $key . "><![CDATA[" . $val . "]]></" . $key . ">";
+            }
+        }
+        $xml .= "</xml>";
+        return $xml;
+    }
+    public function FromXml($xml)
+    {
+        if (!$xml) {
+            throw new WxPayException("xml数据异常!");
+        }
+        libxml_disable_entity_loader(true);
+        $this->values = json_decode(json_encode(simplexml_load_string($xml, "SimpleXMLElement", LIBXML_NOCDATA)), true);
+        return $this->values;
+    }
+    public function ToUrlParams()
+    {
+        $buff = '';
+        foreach ($this->values as $k => $v) {
+            if ($k != "sign" && $v != '' && !is_array($v)) {
+                $buff .= $k . "=" . $v . "&";
+            }
+        }
+        $buff = trim($buff, "&");
+        return $buff;
+    }
+    public function MakeSign($config, $needSignType = true)
+    {
+        if ($needSignType) {
+            $this->SetSignType($config->GetSignType());
+        }
+        ksort($this->values);
+        $string = $this->ToUrlParams();
+        $string = $string . "&key=" . $config->GetKey();
+        if ($config->GetSignType() == "MD5") {
+            $string = md5($string);
+        } else {
+            if ($config->GetSignType() == "HMAC-SHA256") {
+                $string = hash_hmac("sha256", $string, $config->GetKey());
+            } else {
+                throw new WxPayException("签名类型不支持!");
+            }
+        }
+        $result = strtoupper($string);
+        return $result;
+    }
+    public function GetValues()
+    {
+        return $this->values;
+    }
+}
+class WxPayDataBaseSignMd5 extends WxPayDataBase
+{
+    public function MakeSign($config, $needSignType = false)
+    {
+        if ($needSignType) {
+            $this->SetSignType($config->GetSignType());
+        }
+        ksort($this->values);
+        $string = $this->ToUrlParams();
+        $string = $string . "&key=" . $config->GetKey();
+        $string = md5($string);
+        $result = strtoupper($string);
+        return $result;
+    }
+}
+class WxPayResults extends WxPayDataBase
+{
+    public function MakeSign($config, $needSignType = false)
+    {
+        ksort($this->values);
+        $string = $this->ToUrlParams();
+        $string = $string . "&key=" . $config->GetKey();
+        if (strlen($this->GetSign()) <= 32) {
+            $string = md5($string);
+        } else {
+            $string = hash_hmac("sha256", $string, $config->GetKey());
+        }
+        $result = strtoupper($string);
+        return $result;
+    }
+    public function CheckSign($config)
+    {
+        if (!$this->IsSignSet()) {
+            throw new WxPayException("签名错误!");
+        }
+        $sign = $this->MakeSign($config, false);
+        if ($this->GetSign() == $sign) {
+            return true;
+        }
+        throw new WxPayException("签名错误!");
+    }
+    public function FromArray($array)
+    {
+        $this->values = $array;
+    }
+    public static function InitFromArray($config, $array, $noCheckSign = false)
+    {
+        $obj = new self();
+        $obj->FromArray($array);
+        if ($noCheckSign == false) {
+            $obj->CheckSign($config);
+        }
+        return $obj;
+    }
+    public function SetData($key, $value)
+    {
+        $this->values[$key] = $value;
+    }
+    public static function Init($config, $xml)
+    {
+        $obj = new self();
+        $obj->FromXml($xml);
+        if ($obj->values["return_code"] != "SUCCESS") {
+            foreach ($obj->values as $key => $value) {
+                if ($key != "return_code" && $key != "return_msg") {
+                    throw new WxPayException("输入数据存在异常!");
+                    return false;
+                }
+            }
+            return $obj->GetValues();
+        }
+        $obj->CheckSign($config);
+        return $obj->GetValues();
+    }
+}
+class WxPayNotifyResults extends WxPayResults
+{
+    public static function Init($config, $xml)
+    {
+        $obj = new self();
+        $obj->FromXml($xml);
+        $obj->CheckSign($config);
+        return $obj;
+    }
+}
+class WxPayNotifyReply extends WxPayDataBaseSignMd5
+{
+    public function SetReturn_code($return_code)
+    {
+        $this->values["return_code"] = $return_code;
+    }
+    public function GetReturn_code()
+    {
+        return $this->values["return_code"];
+    }
+    public function SetReturn_msg($return_msg)
+    {
+        $this->values["return_msg"] = $return_msg;
+    }
+    public function GetReturn_msg()
+    {
+        return $this->values["return_msg"];
+    }
+    public function SetData($key, $value)
+    {
+        $this->values[$key] = $value;
+    }
+}
+class WxPayUnifiedOrder extends WxPayDataBase
+{
+    public function SetAppid($value)
+    {
+        $this->values["appid"] = $value;
+    }
+    public function GetAppid()
+    {
+        return $this->values["appid"];
+    }
+    public function IsAppidSet()
+    {
+        return array_key_exists("appid", $this->values);
+    }
+    public function SetMch_id($value)
+    {
+        $this->values["mch_id"] = $value;
+    }
+    public function GetMch_id()
+    {
+        return $this->values["mch_id"];
+    }
+    public function IsMch_idSet()
+    {
+        return array_key_exists("mch_id", $this->values);
+    }
+    public function SetDevice_info($value)
+    {
+        $this->values["device_info"] = $value;
+    }
+    public function GetDevice_info()
+    {
+        return $this->values["device_info"];
+    }
+    public function IsDevice_infoSet()
+    {
+        return array_key_exists("device_info", $this->values);
+    }
+    public function SetNonce_str($value)
+    {
+        $this->values["nonce_str"] = $value;
+    }
+    public function GetNonce_str()
+    {
+        return $this->values["nonce_str"];
+    }
+    public function IsNonce_strSet()
+    {
+        return array_key_exists("nonce_str", $this->values);
+    }
+    public function SetBody($value)
+    {
+        $this->values["body"] = $value;
+    }
+    public function GetBody()
+    {
+        return $this->values["body"];
+    }
+    public function IsBodySet()
+    {
+        return array_key_exists("body", $this->values);
+    }
+    public function SetDetail($value)
+    {
+        $this->values["detail"] = $value;
+    }
+    public function GetDetail()
+    {
+        return $this->values["detail"];
+    }
+    public function IsDetailSet()
+    {
+        return array_key_exists("detail", $this->values);
+    }
+    public function SetAttach($value)
+    {
+        $this->values["attach"] = $value;
+    }
+    public function GetAttach()
+    {
+        return $this->values["attach"];
+    }
+    public function IsAttachSet()
+    {
+        return array_key_exists("attach", $this->values);
+    }
+    public function SetOut_trade_no($value)
+    {
+        $this->values["out_trade_no"] = $value;
+    }
+    public function GetOut_trade_no()
+    {
+        return $this->values["out_trade_no"];
+    }
+    public function IsOut_trade_noSet()
+    {
+        return array_key_exists("out_trade_no", $this->values);
+    }
+    public function SetFee_type($value)
+    {
+        $this->values["fee_type"] = $value;
+    }
+    public function GetFee_type()
+    {
+        return $this->values["fee_type"];
+    }
+    public function IsFee_typeSet()
+    {
+        return array_key_exists("fee_type", $this->values);
+    }
+    public function SetTotal_fee($value)
+    {
+        $this->values["total_fee"] = $value;
+    }
+    public function GetTotal_fee()
+    {
+        return $this->values["total_fee"];
+    }
+    public function IsTotal_feeSet()
+    {
+        return array_key_exists("total_fee", $this->values);
+    }
+    public function SetSpbill_create_ip($value)
+    {
+        $this->values["spbill_create_ip"] = $value;
+    }
+    public function GetSpbill_create_ip()
+    {
+        return $this->values["spbill_create_ip"];
+    }
+    public function IsSpbill_create_ipSet()
+    {
+        return array_key_exists("spbill_create_ip", $this->values);
+    }
+    public function SetTime_start($value)
+    {
+        $this->values["time_start"] = $value;
+    }
+    public function GetTime_start()
+    {
+        return $this->values["time_start"];
+    }
+    public function IsTime_startSet()
+    {
+        return array_key_exists("time_start", $this->values);
+    }
+    public function SetTime_expire($value)
+    {
+        $this->values["time_expire"] = $value;
+    }
+    public function GetTime_expire()
+    {
+        return $this->values["time_expire"];
+    }
+    public function IsTime_expireSet()
+    {
+        return array_key_exists("time_expire", $this->values);
+    }
+    public function SetGoods_tag($value)
+    {
+        $this->values["goods_tag"] = $value;
+    }
+    public function GetGoods_tag()
+    {
+        return $this->values["goods_tag"];
+    }
+    public function IsGoods_tagSet()
+    {
+        return array_key_exists("goods_tag", $this->values);
+    }
+    public function SetNotify_url($value)
+    {
+        $this->values["notify_url"] = $value;
+    }
+    public function GetNotify_url()
+    {
+        return $this->values["notify_url"];
+    }
+    public function IsNotify_urlSet()
+    {
+        return array_key_exists("notify_url", $this->values);
+    }
+    public function SetTrade_type($value)
+    {
+        $this->values["trade_type"] = $value;
+    }
+    public function GetTrade_type()
+    {
+        return $this->values["trade_type"];
+    }
+    public function IsTrade_typeSet()
+    {
+        return array_key_exists("trade_type", $this->values);
+    }
+    public function SetProduct_id($value)
+    {
+        $this->values["product_id"] = $value;
+    }
+    public function GetProduct_id()
+    {
+        return $this->values["product_id"];
+    }
+    public function IsProduct_idSet()
+    {
+        return array_key_exists("product_id", $this->values);
+    }
+    public function SetOpenid($value)
+    {
+        $this->values["openid"] = $value;
+    }
+    public function GetOpenid()
+    {
+        return $this->values["openid"];
+    }
+    public function IsOpenidSet()
+    {
+        return array_key_exists("openid", $this->values);
+    }
+}
+class WxPayOrderQuery extends WxPayDataBase
+{
+    public function SetAppid($value)
+    {
+        $this->values["appid"] = $value;
+    }
+    public function GetAppid()
+    {
+        return $this->values["appid"];
+    }
+    public function IsAppidSet()
+    {
+        return array_key_exists("appid", $this->values);
+    }
+    public function SetMch_id($value)
+    {
+        $this->values["mch_id"] = $value;
+    }
+    public function GetMch_id()
+    {
+        return $this->values["mch_id"];
+    }
+    public function IsMch_idSet()
+    {
+        return array_key_exists("mch_id", $this->values);
+    }
+    public function SetTransaction_id($value)
+    {
+        $this->values["transaction_id"] = $value;
+    }
+    public function GetTransaction_id()
+    {
+        return $this->values["transaction_id"];
+    }
+    public function IsTransaction_idSet()
+    {
+        return array_key_exists("transaction_id", $this->values);
+    }
+    public function SetOut_trade_no($value)
+    {
+        $this->values["out_trade_no"] = $value;
+    }
+    public function GetOut_trade_no()
+    {
+        return $this->values["out_trade_no"];
+    }
+    public function IsOut_trade_noSet()
+    {
+        return array_key_exists("out_trade_no", $this->values);
+    }
+    public function SetNonce_str($value)
+    {
+        $this->values["nonce_str"] = $value;
+    }
+    public function GetNonce_str()
+    {
+        return $this->values["nonce_str"];
+    }
+    public function IsNonce_strSet()
+    {
+        return array_key_exists("nonce_str", $this->values);
+    }
+}
+class WxPayCloseOrder extends WxPayDataBase
+{
+    public function SetAppid($value)
+    {
+        $this->values["appid"] = $value;
+    }
+    public function GetAppid()
+    {
+        return $this->values["appid"];
+    }
+    public function IsAppidSet()
+    {
+        return array_key_exists("appid", $this->values);
+    }
+    public function SetMch_id($value)
+    {
+        $this->values["mch_id"] = $value;
+    }
+    public function GetMch_id()
+    {
+        return $this->values["mch_id"];
+    }
+    public function IsMch_idSet()
+    {
+        return array_key_exists("mch_id", $this->values);
+    }
+    public function SetOut_trade_no($value)
+    {
+        $this->values["out_trade_no"] = $value;
+    }
+    public function GetOut_trade_no()
+    {
+        return $this->values["out_trade_no"];
+    }
+    public function IsOut_trade_noSet()
+    {
+        return array_key_exists("out_trade_no", $this->values);
+    }
+    public function SetNonce_str($value)
+    {
+        $this->values["nonce_str"] = $value;
+    }
+    public function GetNonce_str()
+    {
+        return $this->values["nonce_str"];
+    }
+    public function IsNonce_strSet()
+    {
+        return array_key_exists("nonce_str", $this->values);
+    }
+}
+class WxPayRefund extends WxPayDataBase
+{
+    public function SetAppid($value)
+    {
+        $this->values["appid"] = $value;
+    }
+    public function GetAppid()
+    {
+        return $this->values["appid"];
+    }
+    public function IsAppidSet()
+    {
+        return array_key_exists("appid", $this->values);
+    }
+    public function SetMch_id($value)
+    {
+        $this->values["mch_id"] = $value;
+    }
+    public function GetMch_id()
+    {
+        return $this->values["mch_id"];
+    }
+    public function IsMch_idSet()
+    {
+        return array_key_exists("mch_id", $this->values);
+    }
+    public function SetDevice_info($value)
+    {
+        $this->values["device_info"] = $value;
+    }
+    public function GetDevice_info()
+    {
+        return $this->values["device_info"];
+    }
+    public function IsDevice_infoSet()
+    {
+        return array_key_exists("device_info", $this->values);
+    }
+    public function SetNonce_str($value)
+    {
+        $this->values["nonce_str"] = $value;
+    }
+    public function GetNonce_str()
+    {
+        return $this->values["nonce_str"];
+    }
+    public function IsNonce_strSet()
+    {
+        return array_key_exists("nonce_str", $this->values);
+    }
+    public function SetTransaction_id($value)
+    {
+        $this->values["transaction_id"] = $value;
+    }
+    public function GetTransaction_id()
+    {
+        return $this->values["transaction_id"];
+    }
+    public function IsTransaction_idSet()
+    {
+        return array_key_exists("transaction_id", $this->values);
+    }
+    public function SetOut_trade_no($value)
+    {
+        $this->values["out_trade_no"] = $value;
+    }
+    public function GetOut_trade_no()
+    {
+        return $this->values["out_trade_no"];
+    }
+    public function IsOut_trade_noSet()
+    {
+        return array_key_exists("out_trade_no", $this->values);
+    }
+    public function SetOut_refund_no($value)
+    {
+        $this->values["out_refund_no"] = $value;
+    }
+    public function GetOut_refund_no()
+    {
+        return $this->values["out_refund_no"];
+    }
+    public function IsOut_refund_noSet()
+    {
+        return array_key_exists("out_refund_no", $this->values);
+    }
+    public function SetTotal_fee($value)
+    {
+        $this->values["total_fee"] = $value;
+    }
+    public function GetTotal_fee()
+    {
+        return $this->values["total_fee"];
+    }
+    public function IsTotal_feeSet()
+    {
+        return array_key_exists("total_fee", $this->values);
+    }
+    public function SetRefund_fee($value)
+    {
+        $this->values["refund_fee"] = $value;
+    }
+    public function GetRefund_fee()
+    {
+        return $this->values["refund_fee"];
+    }
+    public function IsRefund_feeSet()
+    {
+        return array_key_exists("refund_fee", $this->values);
+    }
+    public function SetRefund_fee_type($value)
+    {
+        $this->values["refund_fee_type"] = $value;
+    }
+    public function GetRefund_fee_type()
+    {
+        return $this->values["refund_fee_type"];
+    }
+    public function IsRefund_fee_typeSet()
+    {
+        return array_key_exists("refund_fee_type", $this->values);
+    }
+    public function SetOp_user_id($value)
+    {
+        $this->values["op_user_id"] = $value;
+    }
+    public function GetOp_user_id()
+    {
+        return $this->values["op_user_id"];
+    }
+    public function IsOp_user_idSet()
+    {
+        return array_key_exists("op_user_id", $this->values);
+    }
+}
+class WxPayRefundQuery extends WxPayDataBase
+{
+    public function SetAppid($value)
+    {
+        $this->values["appid"] = $value;
+    }
+    public function GetAppid()
+    {
+        return $this->values["appid"];
+    }
+    public function IsAppidSet()
+    {
+        return array_key_exists("appid", $this->values);
+    }
+    public function SetMch_id($value)
+    {
+        $this->values["mch_id"] = $value;
+    }
+    public function GetMch_id()
+    {
+        return $this->values["mch_id"];
+    }
+    public function IsMch_idSet()
+    {
+        return array_key_exists("mch_id", $this->values);
+    }
+    public function SetDevice_info($value)
+    {
+        $this->values["device_info"] = $value;
+    }
+    public function GetDevice_info()
+    {
+        return $this->values["device_info"];
+    }
+    public function IsDevice_infoSet()
+    {
+        return array_key_exists("device_info", $this->values);
+    }
+    public function SetNonce_str($value)
+    {
+        $this->values["nonce_str"] = $value;
+    }
+    public function GetNonce_str()
+    {
+        return $this->values["nonce_str"];
+    }
+    public function IsNonce_strSet()
+    {
+        return array_key_exists("nonce_str", $this->values);
+    }
+    public function SetTransaction_id($value)
+    {
+        $this->values["transaction_id"] = $value;
+    }
+    public function GetTransaction_id()
+    {
+        return $this->values["transaction_id"];
+    }
+    public function IsTransaction_idSet()
+    {
+        return array_key_exists("transaction_id", $this->values);
+    }
+    public function SetOut_trade_no($value)
+    {
+        $this->values["out_trade_no"] = $value;
+    }
+    public function GetOut_trade_no()
+    {
+        return $this->values["out_trade_no"];
+    }
+    public function IsOut_trade_noSet()
+    {
+        return array_key_exists("out_trade_no", $this->values);
+    }
+    public function SetOut_refund_no($value)
+    {
+        $this->values["out_refund_no"] = $value;
+    }
+    public function GetOut_refund_no()
+    {
+        return $this->values["out_refund_no"];
+    }
+    public function IsOut_refund_noSet()
+    {
+        return array_key_exists("out_refund_no", $this->values);
+    }
+    public function SetRefund_id($value)
+    {
+        $this->values["refund_id"] = $value;
+    }
+    public function GetRefund_id()
+    {
+        return $this->values["refund_id"];
+    }
+    public function IsRefund_idSet()
+    {
+        return array_key_exists("refund_id", $this->values);
+    }
+}
+class WxPayDownloadBill extends WxPayDataBase
+{
+    public function SetAppid($value)
+    {
+        $this->values["appid"] = $value;
+    }
+    public function GetAppid()
+    {
+        return $this->values["appid"];
+    }
+    public function IsAppidSet()
+    {
+        return array_key_exists("appid", $this->values);
+    }
+    public function SetMch_id($value)
+    {
+        $this->values["mch_id"] = $value;
+    }
+    public function GetMch_id()
+    {
+        return $this->values["mch_id"];
+    }
+    public function IsMch_idSet()
+    {
+        return array_key_exists("mch_id", $this->values);
+    }
+    public function SetDevice_info($value)
+    {
+        $this->values["device_info"] = $value;
+    }
+    public function GetDevice_info()
+    {
+        return $this->values["device_info"];
+    }
+    public function IsDevice_infoSet()
+    {
+        return array_key_exists("device_info", $this->values);
+    }
+    public function SetNonce_str($value)
+    {
+        $this->values["nonce_str"] = $value;
+    }
+    public function GetNonce_str()
+    {
+        return $this->values["nonce_str"];
+    }
+    public function IsNonce_strSet()
+    {
+        return array_key_exists("nonce_str", $this->values);
+    }
+    public function SetBill_date($value)
+    {
+        $this->values["bill_date"] = $value;
+    }
+    public function GetBill_date()
+    {
+        return $this->values["bill_date"];
+    }
+    public function IsBill_dateSet()
+    {
+        return array_key_exists("bill_date", $this->values);
+    }
+    public function SetBill_type($value)
+    {
+        $this->values["bill_type"] = $value;
+    }
+    public function GetBill_type()
+    {
+        return $this->values["bill_type"];
+    }
+    public function IsBill_typeSet()
+    {
+        return array_key_exists("bill_type", $this->values);
+    }
+}
+class WxPayReport extends WxPayDataBase
+{
+    public function SetAppid($value)
+    {
+        $this->values["appid"] = $value;
+    }
+    public function GetAppid()
+    {
+        return $this->values["appid"];
+    }
+    public function IsAppidSet()
+    {
+        return array_key_exists("appid", $this->values);
+    }
+    public function SetMch_id($value)
+    {
+        $this->values["mch_id"] = $value;
+    }
+    public function GetMch_id()
+    {
+        return $this->values["mch_id"];
+    }
+    public function IsMch_idSet()
+    {
+        return array_key_exists("mch_id", $this->values);
+    }
+    public function SetDevice_info($value)
+    {
+        $this->values["device_info"] = $value;
+    }
+    public function GetDevice_info()
+    {
+        return $this->values["device_info"];
+    }
+    public function IsDevice_infoSet()
+    {
+        return array_key_exists("device_info", $this->values);
+    }
+    public function SetNonce_str($value)
+    {
+        $this->values["nonce_str"] = $value;
+    }
+    public function GetNonce_str()
+    {
+        return $this->values["nonce_str"];
+    }
+    public function IsNonce_strSet()
+    {
+        return array_key_exists("nonce_str", $this->values);
+    }
+    public function SetInterface_url($value)
+    {
+        $this->values["interface_url"] = $value;
+    }
+    public function GetInterface_url()
+    {
+        return $this->values["interface_url"];
+    }
+    public function IsInterface_urlSet()
+    {
+        return array_key_exists("interface_url", $this->values);
+    }
+    public function SetExecute_time_($value)
+    {
+        $this->values["execute_time_"] = $value;
+    }
+    public function GetExecute_time_()
+    {
+        return $this->values["execute_time_"];
+    }
+    public function IsExecute_time_Set()
+    {
+        return array_key_exists("execute_time_", $this->values);
+    }
+    public function SetReturn_code($value)
+    {
+        $this->values["return_code"] = $value;
+    }
+    public function GetReturn_code()
+    {
+        return $this->values["return_code"];
+    }
+    public function IsReturn_codeSet()
+    {
+        return array_key_exists("return_code", $this->values);
+    }
+    public function SetReturn_msg($value)
+    {
+        $this->values["return_msg"] = $value;
+    }
+    public function GetReturn_msg()
+    {
+        return $this->values["return_msg"];
+    }
+    public function IsReturn_msgSet()
+    {
+        return array_key_exists("return_msg", $this->values);
+    }
+    public function SetResult_code($value)
+    {
+        $this->values["result_code"] = $value;
+    }
+    public function GetResult_code()
+    {
+        return $this->values["result_code"];
+    }
+    public function IsResult_codeSet()
+    {
+        return array_key_exists("result_code", $this->values);
+    }
+    public function SetErr_code($value)
+    {
+        $this->values["err_code"] = $value;
+    }
+    public function GetErr_code()
+    {
+        return $this->values["err_code"];
+    }
+    public function IsErr_codeSet()
+    {
+        return array_key_exists("err_code", $this->values);
+    }
+    public function SetErr_code_des($value)
+    {
+        $this->values["err_code_des"] = $value;
+    }
+    public function GetErr_code_des()
+    {
+        return $this->values["err_code_des"];
+    }
+    public function IsErr_code_desSet()
+    {
+        return array_key_exists("err_code_des", $this->values);
+    }
+    public function SetOut_trade_no($value)
+    {
+        $this->values["out_trade_no"] = $value;
+    }
+    public function GetOut_trade_no()
+    {
+        return $this->values["out_trade_no"];
+    }
+    public function IsOut_trade_noSet()
+    {
+        return array_key_exists("out_trade_no", $this->values);
+    }
+    public function SetUser_ip($value)
+    {
+        $this->values["user_ip"] = $value;
+    }
+    public function GetUser_ip()
+    {
+        return $this->values["user_ip"];
+    }
+    public function IsUser_ipSet()
+    {
+        return array_key_exists("user_ip", $this->values);
+    }
+    public function SetTime($value)
+    {
+        $this->values["time"] = $value;
+    }
+    public function GetTime()
+    {
+        return $this->values["time"];
+    }
+    public function IsTimeSet()
+    {
+        return array_key_exists("time", $this->values);
+    }
+}
+class WxPayShortUrl extends WxPayDataBase
+{
+    public function SetAppid($value)
+    {
+        $this->values["appid"] = $value;
+    }
+    public function GetAppid()
+    {
+        return $this->values["appid"];
+    }
+    public function IsAppidSet()
+    {
+        return array_key_exists("appid", $this->values);
+    }
+    public function SetMch_id($value)
+    {
+        $this->values["mch_id"] = $value;
+    }
+    public function GetMch_id()
+    {
+        return $this->values["mch_id"];
+    }
+    public function IsMch_idSet()
+    {
+        return array_key_exists("mch_id", $this->values);
+    }
+    public function SetLong_url($value)
+    {
+        $this->values["long_url"] = $value;
+    }
+    public function GetLong_url()
+    {
+        return $this->values["long_url"];
+    }
+    public function IsLong_urlSet()
+    {
+        return array_key_exists("long_url", $this->values);
+    }
+    public function SetNonce_str($value)
+    {
+        $this->values["nonce_str"] = $value;
+    }
+    public function GetNonce_str()
+    {
+        return $this->values["nonce_str"];
+    }
+    public function IsNonce_strSet()
+    {
+        return array_key_exists("nonce_str", $this->values);
+    }
+}
+class WxPayMicroPay extends WxPayDataBase
+{
+    public function SetAppid($value)
+    {
+        $this->values["appid"] = $value;
+    }
+    public function GetAppid()
+    {
+        return $this->values["appid"];
+    }
+    public function IsAppidSet()
+    {
+        return array_key_exists("appid", $this->values);
+    }
+    public function SetMch_id($value)
+    {
+        $this->values["mch_id"] = $value;
+    }
+    public function GetMch_id()
+    {
+        return $this->values["mch_id"];
+    }
+    public function IsMch_idSet()
+    {
+        return array_key_exists("mch_id", $this->values);
+    }
+    public function SetDevice_info($value)
+    {
+        $this->values["device_info"] = $value;
+    }
+    public function GetDevice_info()
+    {
+        return $this->values["device_info"];
+    }
+    public function IsDevice_infoSet()
+    {
+        return array_key_exists("device_info", $this->values);
+    }
+    public function SetNonce_str($value)
+    {
+        $this->values["nonce_str"] = $value;
+    }
+    public function GetNonce_str()
+    {
+        return $this->values["nonce_str"];
+    }
+    public function IsNonce_strSet()
+    {
+        return array_key_exists("nonce_str", $this->values);
+    }
+    public function SetBody($value)
+    {
+        $this->values["body"] = $value;
+    }
+    public function GetBody()
+    {
+        return $this->values["body"];
+    }
+    public function IsBodySet()
+    {
+        return array_key_exists("body", $this->values);
+    }
+    public function SetDetail($value)
+    {
+        $this->values["detail"] = $value;
+    }
+    public function GetDetail()
+    {
+        return $this->values["detail"];
+    }
+    public function IsDetailSet()
+    {
+        return array_key_exists("detail", $this->values);
+    }
+    public function SetAttach($value)
+    {
+        $this->values["attach"] = $value;
+    }
+    public function GetAttach()
+    {
+        return $this->values["attach"];
+    }
+    public function IsAttachSet()
+    {
+        return array_key_exists("attach", $this->values);
+    }
+    public function SetOut_trade_no($value)
+    {
+        $this->values["out_trade_no"] = $value;
+    }
+    public function GetOut_trade_no()
+    {
+        return $this->values["out_trade_no"];
+    }
+    public function IsOut_trade_noSet()
+    {
+        return array_key_exists("out_trade_no", $this->values);
+    }
+    public function SetTotal_fee($value)
+    {
+        $this->values["total_fee"] = $value;
+    }
+    public function GetTotal_fee()
+    {
+        return $this->values["total_fee"];
+    }
+    public function IsTotal_feeSet()
+    {
+        return array_key_exists("total_fee", $this->values);
+    }
+    public function SetFee_type($value)
+    {
+        $this->values["fee_type"] = $value;
+    }
+    public function GetFee_type()
+    {
+        return $this->values["fee_type"];
+    }
+    public function IsFee_typeSet()
+    {
+        return array_key_exists("fee_type", $this->values);
+    }
+    public function SetSpbill_create_ip($value)
+    {
+        $this->values["spbill_create_ip"] = $value;
+    }
+    public function GetSpbill_create_ip()
+    {
+        return $this->values["spbill_create_ip"];
+    }
+    public function IsSpbill_create_ipSet()
+    {
+        return array_key_exists("spbill_create_ip", $this->values);
+    }
+    public function SetTime_start($value)
+    {
+        $this->values["time_start"] = $value;
+    }
+    public function GetTime_start()
+    {
+        return $this->values["time_start"];
+    }
+    public function IsTime_startSet()
+    {
+        return array_key_exists("time_start", $this->values);
+    }
+    public function SetTime_expire($value)
+    {
+        $this->values["time_expire"] = $value;
+    }
+    public function GetTime_expire()
+    {
+        return $this->values["time_expire"];
+    }
+    public function IsTime_expireSet()
+    {
+        return array_key_exists("time_expire", $this->values);
+    }
+    public function SetGoods_tag($value)
+    {
+        $this->values["goods_tag"] = $value;
+    }
+    public function GetGoods_tag()
+    {
+        return $this->values["goods_tag"];
+    }
+    public function IsGoods_tagSet()
+    {
+        return array_key_exists("goods_tag", $this->values);
+    }
+    public function SetAuth_code($value)
+    {
+        $this->values["auth_code"] = $value;
+    }
+    public function GetAuth_code()
+    {
+        return $this->values["auth_code"];
+    }
+    public function IsAuth_codeSet()
+    {
+        return array_key_exists("auth_code", $this->values);
+    }
+}
+class WxPayReverse extends WxPayDataBase
+{
+    public function SetAppid($value)
+    {
+        $this->values["appid"] = $value;
+    }
+    public function GetAppid()
+    {
+        return $this->values["appid"];
+    }
+    public function IsAppidSet()
+    {
+        return array_key_exists("appid", $this->values);
+    }
+    public function SetMch_id($value)
+    {
+        $this->values["mch_id"] = $value;
+    }
+    public function GetMch_id()
+    {
+        return $this->values["mch_id"];
+    }
+    public function IsMch_idSet()
+    {
+        return array_key_exists("mch_id", $this->values);
+    }
+    public function SetTransaction_id($value)
+    {
+        $this->values["transaction_id"] = $value;
+    }
+    public function GetTransaction_id()
+    {
+        return $this->values["transaction_id"];
+    }
+    public function IsTransaction_idSet()
+    {
+        return array_key_exists("transaction_id", $this->values);
+    }
+    public function SetOut_trade_no($value)
+    {
+        $this->values["out_trade_no"] = $value;
+    }
+    public function GetOut_trade_no()
+    {
+        return $this->values["out_trade_no"];
+    }
+    public function IsOut_trade_noSet()
+    {
+        return array_key_exists("out_trade_no", $this->values);
+    }
+    public function SetNonce_str($value)
+    {
+        $this->values["nonce_str"] = $value;
+    }
+    public function GetNonce_str()
+    {
+        return $this->values["nonce_str"];
+    }
+    public function IsNonce_strSet()
+    {
+        return array_key_exists("nonce_str", $this->values);
+    }
+}
+class WxPayJsApiPay extends WxPayDataBase
+{
+    public function SetAppid($value)
+    {
+        $this->values["appId"] = $value;
+    }
+    public function GetAppid()
+    {
+        return $this->values["appId"];
+    }
+    public function IsAppidSet()
+    {
+        return array_key_exists("appId", $this->values);
+    }
+    public function SetTimeStamp($value)
+    {
+        $this->values["timeStamp"] = $value;
+    }
+    public function GetTimeStamp()
+    {
+        return $this->values["timeStamp"];
+    }
+    public function IsTimeStampSet()
+    {
+        return array_key_exists("timeStamp", $this->values);
+    }
+    public function SetNonceStr($value)
+    {
+        $this->values["nonceStr"] = $value;
+    }
+    public function GetReturn_code()
+    {
+        return $this->values["nonceStr"];
+    }
+    public function IsReturn_codeSet()
+    {
+        return array_key_exists("nonceStr", $this->values);
+    }
+    public function SetPackage($value)
+    {
+        $this->values["package"] = $value;
+    }
+    public function GetPackage()
+    {
+        return $this->values["package"];
+    }
+    public function IsPackageSet()
+    {
+        return array_key_exists("package", $this->values);
+    }
+    public function SetSignType($value)
+    {
+        $this->values["signType"] = $value;
+    }
+    public function GetSignType()
+    {
+        return $this->values["signType"];
+    }
+    public function IsSignTypeSet()
+    {
+        return array_key_exists("signType", $this->values);
+    }
+    public function SetPaySign($value)
+    {
+        $this->values["paySign"] = $value;
+    }
+    public function GetPaySign()
+    {
+        return $this->values["paySign"];
+    }
+    public function IsPaySignSet()
+    {
+        return array_key_exists("paySign", $this->values);
+    }
+}
+class WxPayBizPayUrl extends WxPayDataBaseSignMd5
+{
+    public function SetAppid($value)
+    {
+        $this->values["appid"] = $value;
+    }
+    public function GetAppid()
+    {
+        return $this->values["appid"];
+    }
+    public function IsAppidSet()
+    {
+        return array_key_exists("appid", $this->values);
+    }
+    public function SetMch_id($value)
+    {
+        $this->values["mch_id"] = $value;
+    }
+    public function GetMch_id()
+    {
+        return $this->values["mch_id"];
+    }
+    public function IsMch_idSet()
+    {
+        return array_key_exists("mch_id", $this->values);
+    }
+    public function SetTime_stamp($value)
+    {
+        $this->values["time_stamp"] = $value;
+    }
+    public function GetTime_stamp()
+    {
+        return $this->values["time_stamp"];
+    }
+    public function IsTime_stampSet()
+    {
+        return array_key_exists("time_stamp", $this->values);
+    }
+    public function SetNonce_str($value)
+    {
+        $this->values["nonce_str"] = $value;
+    }
+    public function GetNonce_str()
+    {
+        return $this->values["nonce_str"];
+    }
+    public function IsNonce_strSet()
+    {
+        return array_key_exists("nonce_str", $this->values);
+    }
+    public function SetProduct_id($value)
+    {
+        $this->values["product_id"] = $value;
+    }
+    public function GetProduct_id()
+    {
+        return $this->values["product_id"];
+    }
+    public function IsProduct_idSet()
+    {
+        return array_key_exists("product_id", $this->values);
+    }
+}

+ 9 - 0
server/addons/hyb_o2o/inc/lib/WxPay.Exception.php

xqd
@@ -0,0 +1,9 @@
+<?php
+
+class WxPayException extends Exception
+{
+    public function errorMessage()
+    {
+        return $this->getMessage();
+    }
+}

+ 114 - 0
server/addons/hyb_o2o/inc/lib/WxPay.JsApiPay.php

xqd
@@ -0,0 +1,114 @@
+<?php
+//解密QQ:麒擎网络
+require_once "WxPay.Api.php";
+require_once "WxPay.Config.php";
+class JsApiPay
+{
+    public $data = null;
+    public function GetOpenid()
+    {
+        if (!isset($_GET["code"])) {
+            $baseUrl = urlencode("http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . $_SERVER["QUERY_STRING"]);
+            $url = $this->_CreateOauthUrlForCode($baseUrl);
+            Header("Location: {$url}");
+            exit;
+        } else {
+            $code = $_GET["code"];
+            $openid = $this->getOpenidFromMp($code);
+            return $openid;
+        }
+    }
+    public function GetJsApiParameters($UnifiedOrderResult)
+    {
+        if (!array_key_exists("appid", $UnifiedOrderResult) || !array_key_exists("prepay_id", $UnifiedOrderResult) || $UnifiedOrderResult["prepay_id"] == '') {
+            throw new WxPayException("参数错误:" . $UnifiedOrderResult["err_code_des"]);
+        }
+        $jsapi = new WxPayJsApiPay();
+        $jsapi->SetAppid($UnifiedOrderResult["appid"]);
+        $timeStamp = time();
+        $jsapi->SetTimeStamp("{$timeStamp}");
+        $jsapi->SetNonceStr(WxPayApi::getNonceStr());
+        $jsapi->SetPackage("prepay_id=" . $UnifiedOrderResult["prepay_id"]);
+        $config = new WxPayConfig();
+        $jsapi->SetPaySign($jsapi->MakeSign($config));
+        $parameters = json_encode($jsapi->GetValues());
+        return $parameters;
+    }
+    public function GetOpenidFromMp($code)
+    {
+        $url = $this->__CreateOauthUrlForOpenid($code);
+        $ch = curl_init();
+        $curlVersion = curl_version();
+        $config = new WxPayConfig();
+        $ua = "WXPaySDK/3.0.9 (" . PHP_OS . ") PHP/" . PHP_VERSION . " CURL/" . $curlVersion["version"] . " " . $config->GetMerchantId();
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
+        curl_setopt($ch, CURLOPT_USERAGENT, $ua);
+        curl_setopt($ch, CURLOPT_HEADER, FALSE);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
+        $proxyHost = "0.0.0.0";
+        $proxyPort = 0;
+        $config->GetProxy($proxyHost, $proxyPort);
+        if ($proxyHost != "0.0.0.0" && $proxyPort != 0) {
+            curl_setopt($ch, CURLOPT_PROXY, $proxyHost);
+            curl_setopt($ch, CURLOPT_PROXYPORT, $proxyPort);
+        }
+        $res = curl_exec($ch);
+        curl_close($ch);
+        $data = json_decode($res, true);
+        $this->data = $data;
+        $openid = $data["openid"];
+        return $openid;
+    }
+    private function ToUrlParams($urlObj)
+    {
+        $buff = '';
+        foreach ($urlObj as $k => $v) {
+            if ($k != "sign") {
+                $buff .= $k . "=" . $v . "&";
+            }
+        }
+        $buff = trim($buff, "&");
+        return $buff;
+    }
+    public function GetEditAddressParameters()
+    {
+        $config = new WxPayConfig();
+        $getData = $this->data;
+        $data = array();
+        $data["appid"] = $config->GetAppId();
+        $data["url"] = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
+        $time = time();
+        $data["timestamp"] = "{$time}";
+        $data["noncestr"] = WxPayApi::getNonceStr();
+        $data["accesstoken"] = $getData["access_token"];
+        ksort($data);
+        $params = $this->ToUrlParams($data);
+        $addrSign = sha1($params);
+        $afterData = array("addrSign" => $addrSign, "signType" => "sha1", "scope" => "jsapi_address", "appId" => $config->GetAppId(), "timeStamp" => $data["timestamp"], "nonceStr" => $data["noncestr"]);
+        $parameters = json_encode($afterData);
+        return $parameters;
+    }
+    private function _CreateOauthUrlForCode($redirectUrl)
+    {
+        $config = new WxPayConfig();
+        $urlObj["appid"] = $config->GetAppId();
+        $urlObj["redirect_uri"] = "{$redirectUrl}";
+        $urlObj["response_type"] = "code";
+        $urlObj["scope"] = "snsapi_base";
+        $urlObj["state"] = "STATE" . "#wechat_redirect";
+        $bizString = $this->ToUrlParams($urlObj);
+        return "https://open.weixin.qq.com/connect/oauth2/authorize?" . $bizString;
+    }
+    private function __CreateOauthUrlForOpenid($code)
+    {
+        $config = new WxPayConfig();
+        $urlObj["appid"] = $config->GetAppId();
+        $urlObj["secret"] = $config->GetAppSecret();
+        $urlObj["code"] = $code;
+        $urlObj["grant_type"] = "authorization_code";
+        $bizString = $this->ToUrlParams($urlObj);
+        return "https://api.weixin.qq.com/sns/oauth2/access_token?" . $bizString;
+    }
+}

+ 52 - 0
server/addons/hyb_o2o/inc/lib/WxPay.Notify.php

xqd
@@ -0,0 +1,52 @@
+<?php
+//解密QQ:麒擎网络
+class WxPayNotify extends WxPayNotifyReply
+{
+    private $config = null;
+    public final function Handle($config, $needSign = true)
+    {
+        $this->config = $config;
+        $msg = "OK";
+        $result = WxpayApi::notify($config, array($this, "NotifyCallBack"), $msg);
+        if ($result == false) {
+            $this->SetReturn_code("FAIL");
+            $this->SetReturn_msg($msg);
+            $this->ReplyNotify(false);
+            return;
+        } else {
+            $this->SetReturn_code("SUCCESS");
+            $this->SetReturn_msg("OK");
+        }
+        $this->ReplyNotify($needSign);
+    }
+    public function NotifyProcess($objData, $config, &$msg)
+    {
+        return false;
+    }
+    public function LogAfterProcess($xmlData)
+    {
+        return;
+    }
+    public final function NotifyCallBack($data)
+    {
+        $msg = "OK";
+        $result = $this->NotifyProcess($data, $this->config, $msg);
+        if ($result == true) {
+            $this->SetReturn_code("SUCCESS");
+            $this->SetReturn_msg("OK");
+        } else {
+            $this->SetReturn_code("FAIL");
+            $this->SetReturn_msg($msg);
+        }
+        return $result;
+    }
+    private final function ReplyNotify($needSign = true)
+    {
+        if ($needSign == true && $this->GetReturn_code() == "SUCCESS") {
+            $this->SetSign($this->config);
+        }
+        $xml = $this->ToXml();
+        $this->LogAfterProcess($xml);
+        WxpayApi::replyNotify($xml);
+    }
+}

+ 26 - 0
server/addons/hyb_o2o/inc/lib/apiclient_cert.pem

xqd
@@ -0,0 +1,26 @@
+-----BEGIN CERTIFICATE-----
+MIIEbzCCA9igAwIBAgIEAV56wzANBgkqhkiG9w0BAQUFADCBijELMAkGA1UEBhMC
+Q04xEjAQBgNVBAgTCUd1YW5nZG9uZzERMA8GA1UEBxMIU2hlbnpoZW4xEDAOBgNV
+BAoTB1RlbmNlbnQxDDAKBgNVBAsTA1dYRzETMBEGA1UEAxMKTW1wYXltY2hDQTEf
+MB0GCSqGSIb3DQEJARYQbW1wYXltY2hAdGVuY2VudDAeFw0xNzA2MjMwOTAwMjNa
+Fw0yNzA2MjEwOTAwMjNaMIGeMQswCQYDVQQGEwJDTjESMBAGA1UECBMJR3Vhbmdk
+b25nMREwDwYDVQQHEwhTaGVuemhlbjEQMA4GA1UEChMHVGVuY2VudDEOMAwGA1UE
+CxMFTU1QYXkxMzAxBgNVBAMUKuWxseilv+e9keWNmuaAneWIm+e9kee7nOenkeaK
+gOaciemZkOWFrOWPuDERMA8GA1UEBBMIMzI1MzUzMDQwggEiMA0GCSqGSIb3DQEB
+AQUAA4IBDwAwggEKAoIBAQDcDRRPt5QNt6KV2SoAgGYRW4H1kLC4wAiB2opG5KyO
+2uDNbSqC9hfX+cRSJMwmogaSJyHbpgWLeSwnY0ic80KLmvI6DcpqwP0JrMpjVJx1
+AGvuw/N6nuh4d9iis1H/ErotbMu00jdE+nC/PdWlnJOQUNDVRbhsuyUGQFVSf3PT
+KddpxhdTfBcZZo/I2ZJC7lgqcFgAV/iunJSDCKurf41Pe6u4Bean7W2s/v9Nbayu
+HqWjeZ7IhWn62HrZv0xBV37U4XHA3M/eJAT5VvJhaPYB7s7lcSv0GzK+yfJMOw8c
+2LZgJ+xe9ShaYa8ShhIxtMB4rjjXG07FzUpJgWUq3ULnAgMBAAGjggFGMIIBQjAJ
+BgNVHRMEAjAAMCwGCWCGSAGG+EIBDQQfFh0iQ0VTLUNBIEdlbmVyYXRlIENlcnRp
+ZmljYXRlIjAdBgNVHQ4EFgQURnHfE/NuHA6KNwDvKVI0CnBvO9kwgb8GA1UdIwSB
+tzCBtIAUPgUm9iJitBVbiM1kfrDUYqflhnShgZCkgY0wgYoxCzAJBgNVBAYTAkNO
+MRIwEAYDVQQIEwlHdWFuZ2RvbmcxETAPBgNVBAcTCFNoZW56aGVuMRAwDgYDVQQK
+EwdUZW5jZW50MQwwCgYDVQQLEwNXWEcxEzARBgNVBAMTCk1tcGF5bWNoQ0ExHzAd
+BgkqhkiG9w0BCQEWEG1tcGF5bWNoQHRlbmNlbnSCCQC7VJcrvADoVzAOBgNVHQ8B
+Af8EBAMCBsAwFgYDVR0lAQH/BAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQEFBQAD
+gYEAqAyooxl7unZiRC8mIq6fAPJKFeMPrsKvYK1SxcflwA04LaHM2PWbJBRsS7fF
+R/UONM6jMrE+MQH+hdXKj1xnXavU2Ne+9leOcRd+iUPvFIjJZ70g/zArnG2zRogx
+vJXMO6wJhoVkUSg7ZU4MpdrZMQWH8GlDcdOBrB7lNqXlCRw=
+-----END CERTIFICATE-----

+ 28 - 0
server/addons/hyb_o2o/inc/lib/apiclient_key.pem

xqd
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDcDRRPt5QNt6KV
+2SoAgGYRW4H1kLC4wAiB2opG5KyO2uDNbSqC9hfX+cRSJMwmogaSJyHbpgWLeSwn
+Y0ic80KLmvI6DcpqwP0JrMpjVJx1AGvuw/N6nuh4d9iis1H/ErotbMu00jdE+nC/
+PdWlnJOQUNDVRbhsuyUGQFVSf3PTKddpxhdTfBcZZo/I2ZJC7lgqcFgAV/iunJSD
+CKurf41Pe6u4Bean7W2s/v9NbayuHqWjeZ7IhWn62HrZv0xBV37U4XHA3M/eJAT5
+VvJhaPYB7s7lcSv0GzK+yfJMOw8c2LZgJ+xe9ShaYa8ShhIxtMB4rjjXG07FzUpJ
+gWUq3ULnAgMBAAECggEBAMMdHctpXW+kShdQTTvQna/6UYtp1iiarXBmVIFztcWd
+MgM0LqOcjZvFLVwgoJwIwobJB+54kSYQNSRflj0EPRcINotfOwHZSQRRH8tfdLMR
+wqIdQUCSslJPAdmR4rym4Eny09TrKHKTFXGc5FlKMlWeMu1IOrS+Y5/dX0odFJhA
+NZHpCaZ0XA1sXu4TVwYplnp8QCYvuQWGL8ziDypSA2dBYTZEPl+yi/l1LF4Fh+HD
+Hu73nPBm1W/7hnQhJmdcibb/IjPWdWcxEj3Cr7jlT/vPrybEtfNHV1rsGQQ++3Do
+LXT1Irch+2Zi3rI73EGeEH8jhsOYoP1d4OL0TPu20nECgYEA/exMMjhQbGIpQyyt
+ktdfsi1vP6lgGExPDPb75lv1M1+cRsAL0lyjdwZj0lckNSeEAyul9pntGNpFuzsm
+tU4FsyebL5luXOu/Fdnvwh4DGrvnP6ceVHrIcEYiQeEOmTHRmiUiQbRXu6/Lwvq8
+E/QKoW6J0QSC3i38+qWIrahZUxUCgYEA3dnbAqa3mVU3coDvrrS2EwFD+cOZHnf/
+q7YERt96gHPbKcLZhTAn+zuBQTsJ59mW2gmyfkTDn4FUfStegYmsR1AoSY9IRltG
+37Vyverlmf9k6lQLAyQCvIpZhPG7vpT0vO1XxJG63jplQ4k3wcGq7CtMJJ39B+/9
+OBFYM1i8LQsCgYEAy76RHTLGhVD2Xuo4lDywkp2WSHS1oImKXJLJaPuccg5jrPlo
+AvFGULkV268EZIpCiPC7CHZWIrzxetxpoMzsEebTxIvOXEzlVLk8gnvmbcscMJz9
+3zduIXiFAGt/dTjeQFtPc30rcHQMgXUC+Ne2t/WkK8z83R31gYDVfNI6akkCgYBO
+vqssL7zvYf4CWJ26p04RRNu55aGN3Q4VBtBRz7UNrxHVquHGkqc+V4qzep8zelo/
+Hj4K76F4FlHE9AXheNp7nYoPQhpnTrLDaQZHPv8sQCizvA0Eml2WSo0n0R3QsdKE
+1MHYddmcU6Hp7OSrk3B1z5CBVsqfbKG2qwFhiFeSrQKBgHGJI4MWT62xpMpHxmh7
+7LGBR+3zzHGrP7Oy7s1f9YcVUVrSCc6fWhWZEvrVNMxX/+UclR8CVoOgKwNVc/tR
+8XGNTjjWO8F6r2JCb3hqMfj4Y69GgihAP/sKEq4ViOBAUz8Nfvmzuc+PwMHk+/Yu
+to1scb+K0b0w9vz+Cy8fy0tD
+-----END PRIVATE KEY-----

+ 41 - 0
server/addons/hyb_o2o/inc/mobile/add_aditor.inc.php

xqd
@@ -0,0 +1,41 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$u_id = $_SESSION['u_id'];
+$wxinfo = $this->getSignPackage();
+if ($op == 'display') {
+}
+if ($op == 'add') {
+    $d_id = $_GPC['d_id'];
+    $data = array("u_id" => $u_id, "d_address" => $_REQUEST['d_address'], "d_xxaddress" => $_REQUEST['d_xxaddress'], "d_uname" => $_REQUEST['d_uname'], "d_phone" => $_REQUEST['d_phone'], "uniacid" => $uniacid);
+    if (empty($_REQUEST['d_uname'])) {
+        output_error("请输入姓名");
+    } else {
+        if (empty($_REQUEST['d_phone'])) {
+            output_error("请输入联系电话");
+        } else {
+            if (!empty($_REQUEST['d_phone']) && !preg_match("/^1[34578]{1}\\d{9}\$/", $_REQUEST['d_phone']) && strlen($_REQUEST['d_phone']) != 11) {
+                output_error("联系电话格式错误");
+            } else {
+                if (empty($_REQUEST['d_xxaddress'])) {
+                    output_error("请输入详细地址");
+                } else {
+                    if ($d_id > 0) {
+                        pdo_update("hyb_o2o_address", $data, array("d_id" => $d_id));
+                        output_data('更新成功');
+                    } else {
+                        pdo_insert("hyb_o2o_address", $data);
+                        output_data('添加成功');
+                    }
+                }
+            }
+        }
+    }
+}
+if ($op == 'edit') {
+    $d_id = $_REQUEST['d_id'];
+    $info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_address") . " where d_id=:d_id and u_id=:u_id and uniacid=:uniacid order by d_id desc", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":d_id" => $d_id));
+}
+include $this->template('add_aditor/add_aditor');

+ 36 - 0
server/addons/hyb_o2o/inc/mobile/address.inc.php

xqd
@@ -0,0 +1,36 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$u_id = $_SESSION['u_id'];
+if ($op == 'display') {
+    $d_id = $_REQUEST['d_id'];
+    $index = $_REQUEST['index'];
+    $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_address") . " where u_id=:u_id and uniacid=:uniacid order by d_id desc", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+}
+if ($op == 'updaddress') {
+    $d_id = $_REQUEST['d_id'];
+    $res = pdo_update("hyb_o2o_address", array('d_checked' => 0), array("uniacid" => $uniacid, "u_id" => $u_id, "d_checked" => 1));
+    pdo_update("hyb_o2o_address", array('d_checked' => 1), array("uniacid" => $uniacid, "u_id" => $u_id, "d_id" => $d_id));
+    exit;
+}
+if ($op == 'deladdress') {
+    $d_id = $_REQUEST['d_id'];
+    $res = pdo_delete("hyb_o2o_address", array("d_id" => $d_id, "u_id" => $u_id));
+    output_data("删除成功");
+}
+if ($op == 'getone') {
+    $d_id = $_REQUEST['d_id'];
+    if ($d_id == 0 || empty($d_id)) {
+        //默认查询一个
+        $list = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_address") . " where u_id=:u_id and uniacid=:uniacid and d_checked=1 order by d_id desc", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+        if (empty($list)) {
+            $list = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_address") . " where u_id=:u_id and uniacid=:uniacid order by d_id desc", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+        }
+    } else {
+        $list = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_address") . " where u_id=:u_id and uniacid=:uniacid and d_id=:d_id order by d_id desc", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":d_id" => $d_id));
+    }
+    output_data($list);
+}
+include $this->template('address/address');

+ 90 - 0
server/addons/hyb_o2o/inc/mobile/all.inc.php

xqd
@@ -0,0 +1,90 @@
+<?php
+
+global $_W, $_GPC;
+$uniacid = $_W['uniacid'];
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+error_reporting(1);
+if ($op == 'display') {
+    // $fuwu_mode = m("fuwu");
+    // $list = $fuwu_mode->getAll_tpye('xt_id,xt_name,xt_thumb','xt_parentid='.$_GPC['xt_id'],array(":uniacid"=>$uniacid));
+    $city = $_REQUEST['city'];
+    if (empty($city)) {
+        //查询基本信息
+        $base = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_base") . " where uniacid=:uniacid", array(":uniacid" => $uniacid));
+        $city = $base['city'];
+    }
+    $time = date("Y-m-d H:i:s", time());
+    //父级分类
+    $xiangmutype = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_parentid=0 order by xt_ids desc ", array(":uniacid" => $uniacid));
+    foreach ($xiangmutype as $key => $value) {
+        //子分类
+        $xiangmutypechild = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " WHERE uniacid=:uniacid and xt_parentid=:xt_parentid", array(":uniacid" => $uniacid, ":xt_parentid" => $value['xt_id']));
+        //查询当前城市的商家
+        $shangjia = pdo_fetchall("SELECT s_id FROM " . tablename("hyb_o2o_shangjia") . " WHERE uniacid=:uniacid and s_address like '%{$city}%' and s_status=:s_status and ruzhu_endtime!=:ruzhu_endtime and ruzhu_endtime>'" . $time . "'", array(":uniacid" => $uniacid, ":s_status" => "审核通过", ":ruzhu_endtime" => "已到期"));
+        //查询当前城市商家的项目
+        $arr = [];
+        foreach ($shangjia as $key2 => $value2) {
+            $xiangmu = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " WHERE uniacid=:uniacid and x_shangjia=:x_shangjia and x_status=1", array(":uniacid" => $uniacid, ":x_shangjia" => $value2['s_id']));
+            foreach ($xiangmu as $key2 => $value2) {
+                if (strpos($value2['x_thumb'], "http") === false) {
+                    $value2['x_thumb'] = $_W['attachurl'] . $value2['x_thumb'];
+                }
+                $arr[] = $value2;
+            }
+        }
+        foreach ($xiangmutypechild as $key4 => $value4) {
+            $arrs = array();
+            foreach ($arr as $key3 => $value3) {
+                if ($value3['x_type'] == $value4['xt_id']) {
+                    $arrs[] = $value3;
+                }
+            }
+            $xiangmutypechild[$key4]['xiangmu'] = $arrs;
+        }
+        $xiangmutype[$key]['children_type'] = $xiangmutypechild;
+    }
+    // var_dump($xiangmutype);die;
+    include $this->template('all/all');
+}
+if ($op == 'get_fuwu') {
+    $xt_parentid = $_GPC['xt_id'];
+    $erji = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_parentid=:xt_parentid", array(":uniacid" => $uniacid, ":xt_parentid" => $xt_parentid));
+    if (!empty($erji)) {
+        foreach ($erji as &$values) {
+            if (strpos($values['xt_thumb'], "http") === false) {
+                $values['xt_thumb'] = $_W['attachurl'] . $values['xt_thumb'];
+            }
+        }
+        $list[$key]['erji'] = $erji;
+    } else {
+        unset($list[$key]);
+    }
+    output_data($erji);
+    die;
+    //子分类
+    $xiangmutypechild = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " WHERE uniacid=:uniacid and xt_parentid=:xt_parentid", array(":uniacid" => $uniacid, ":xt_parentid" => $xt_parentid));
+    //查询当前城市的商家
+    $shangjia = pdo_fetchall("SELECT s_id FROM " . tablename("hyb_o2o_shangjia") . " WHERE uniacid=:uniacid and s_address like '%{$city}%' and s_status=:s_status and ruzhu_endtime!=:ruzhu_endtime and ruzhu_endtime>'" . $time . "'", array(":uniacid" => $uniacid, ":s_status" => "审核通过", ":ruzhu_endtime" => "已到期"));
+    //查询当前城市商家的项目
+    $arr = [];
+    foreach ($shangjia as $key2 => $value2) {
+        $xiangmu = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " WHERE uniacid=:uniacid and x_shangjia=:x_shangjia and x_status=1", array(":uniacid" => $uniacid, ":x_shangjia" => $value2['s_id']));
+        foreach ($xiangmu as $key2 => $value2) {
+            if (strpos($value2['x_thumb'], "http") === false) {
+                $value2['x_thumb'] = $_W['attachurl'] . $value2['x_thumb'];
+            }
+            $arr[] = $value2;
+        }
+    }
+    foreach ($xiangmutypechild as $key4 => $value4) {
+        $arrs = array();
+        foreach ($arr as $key3 => $value3) {
+            if ($value3['x_type'] == $value4['xt_id']) {
+                $arrs[] = $value3;
+            }
+        }
+        $xiangmutypechild[$key4]['xiangmu'] = $arrs;
+    }
+    // var_dump($arr);
+    output_data($xiangmutypechild);
+}

+ 31 - 0
server/addons/hyb_o2o/inc/mobile/all.php

xqd
@@ -0,0 +1,31 @@
+<?php
+
+global $_W, $_GPC;
+$uniacid = $_W['uniacid'];
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+error_reporting(1);
+if ($op == 'json') {
+    $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_parentid=0 order by xt_ids desc ", array(":uniacid" => $uniacid));
+    if (!empty($list)) {
+        foreach ($list as $key => $value) {
+            if (strpos($value['xt_thumb'], "http") === false) {
+                $list[$key]['xt_thumb'] = $_W['attachurl'] . $value['xt_thumb'];
+            }
+            $erji = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_parentid=:xt_parentid", array(":uniacid" => $uniacid, ":xt_parentid" => $value['xt_id']));
+            if (!empty($erji)) {
+                foreach ($erji as &$values) {
+                    if (strpos($values['xt_thumb'], "http") === false) {
+                        $values['xt_thumb'] = $_W['attachurl'] . $values['xt_thumb'];
+                    }
+                }
+                $list[$key]['erji'] = $erji;
+            } else {
+                unset($list[$key]);
+            }
+        }
+    }
+    return $this->result(0, "success", $list);
+}
+if ($op == 'display') {
+    include $this->template('login/login');
+}

+ 30 - 0
server/addons/hyb_o2o/inc/mobile/all_type.inc.php

xqd
@@ -0,0 +1,30 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+//error_reporting(E_ALL);
+$fuwu_mode = m("fuwu");
+if ($op == 'display') {
+    // $list = pdo_fetchall("SELECT * FROM ".tablename("hyb_o2o_fuwu_type")." where uniacid=:uniacid and xt_parentid=0 order by xt_ids desc ",array(":uniacid"=>$uniacid));
+    $list = $fuwu_mode->getAll_tpye('*', 'xt_parentid=0', array(":uniacid" => $uniacid));
+    if (!empty($list)) {
+        foreach ($list as $key => $value) {
+            if (strpos($value['xt_thumb'], "http") === false) {
+                $list[$key]['xt_thumb'] = $_W['attachurl'] . $value['xt_thumb'];
+            }
+            $erji = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_parentid=:xt_parentid", array(":uniacid" => $uniacid, ":xt_parentid" => $value['xt_id']));
+            if (!empty($erji)) {
+                foreach ($erji as &$values) {
+                    if (strpos($values['xt_thumb'], "http") === false) {
+                        $values['xt_thumb'] = $_W['attachurl'] . $values['xt_thumb'];
+                    }
+                }
+                $list[$key]['erji'] = $erji;
+            } else {
+                unset($list[$key]);
+            }
+        }
+    }
+}
+include $this->template('all_type/all_type');

+ 54 - 0
server/addons/hyb_o2o/inc/mobile/amount_water.inc.php

xqd
@@ -0,0 +1,54 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$u_id = $_SESSION['u_id'];
+// error_reporting(E_ALL);
+if ($op == 'display') {
+    //doPageFencheng
+    $come = $_REQUEST['come'];
+    if ($come == 'yg') {
+        $yg = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_yuangong") . " WHERE uniacid=:uniacid and y_u_id=:y_u_id", array(":uniacid" => $uniacid, ":y_u_id" => $u_id));
+        $fencheng = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_symx") . " WHERE uniacid=:uniacid and u_id=:u_id and type=:type order by id desc", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":type" => "员工"));
+        $tixian = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_usertixian") . " WHERE uniacid=:uniacid and y_id=:y_id  order by time desc ", array(":uniacid" => $uniacid, ":y_id" => $yg['y_id']));
+    }
+    if ($come == 'sj') {
+        //查询商家
+        $sj = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " WHERE uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+        $fencheng = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_symx") . " WHERE uniacid=:uniacid and u_id=:u_id and type=:type order by id desc", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":type" => "商家"));
+        $tixian = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_usertixian") . " WHERE uniacid=:uniacid and s_id=:s_id order by time desc ", array(":uniacid" => $uniacid, ":s_id" => $sj['s_id']));
+    }
+    if ($come == 'js') {
+        $yg = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_yuangong") . " WHERE uniacid=:uniacid and y_u_id=:y_u_id", array(":uniacid" => $uniacid, ":y_u_id" => $u_id));
+        $fencheng = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_symx") . " WHERE uniacid=:uniacid and u_id=:u_id and type=:type order by id desc ", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":type" => "员工"));
+        $tixian = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_usertixian") . " WHERE uniacid=:uniacid and y_id=:y_id  order by time desc ", array(":uniacid" => $uniacid, ":y_id" => $yg['y_id']));
+    }
+    if (!empty($fencheng)) {
+        foreach ($fencheng as &$value) {
+            if ($value['leixing'] == '0') {
+                $order = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_orderfuwu") . " WHERE uniacid=:uniacid and o_id=:o_id ", array(":uniacid" => $uniacid, ":o_id" => $value['orderid']));
+                $value['ordersn'] = $order['ordersn'];
+                $value['fwname'] = $order['o_xiangmu_name'];
+                $value['fwthumb'] = $order['o_xiangmu_thumb'];
+            }
+            if ($value['leixing'] == '1') {
+                $order = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fadan") . " WHERE uniacid=:uniacid and fa_id=:fa_id", array(":uniacid" => $uniacid, ":fa_id" => $value['fadanid']));
+                $value['ordersn'] = $order['fa_ordersn'];
+                $value['fwname'] = $order['fa_fwname'];
+                $fa_fwimgpath = unserialize($order['fa_fwimgpath']);
+                $value['fwthumb'] = $fa_fwimgpath[0];
+            }
+            if ($value['leixing'] == '2') {
+                $order = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_orderjishi") . " WHERE uniacid=:uniacid and o_id=:o_id", array(":uniacid" => $uniacid, ":o_id" => $value['jishiyuyueid']));
+                $value['ordersn'] = $order['ordersn'];
+                $value['fwname'] = $order['o_fuwuname'];
+                $value['fwthumb'] = $_W['attachurl'] . $order['fwtp_thumb'];
+            }
+        }
+    }
+    $info['fencheng'] = $fencheng;
+    $info['tixian'] = $tixian;
+    // var_dump($info);
+}
+include $this->template('amount_water/amount_water');

+ 42 - 0
server/addons/hyb_o2o/inc/mobile/apply_distributor.inc.php

xqd
@@ -0,0 +1,42 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$u_id = $_SESSION['u_id'];
+if ($op == 'display') {
+    // error_reporting(E_ALL);
+    $list = pdo_fetch("SELECT * from " . tablename("hyb_o2o_fenxiao") . " where uniacid=:uniacid", array(":uniacid" => $uniacid));
+    $list['fzthumb'] = unserialize($list['fzthumb']);
+    foreach ($list['fzthumb'] as &$value) {
+        if (strpos($value, "http") === false) {
+            $value = $_W['attachurl'] . $value;
+        }
+    }
+    $list['sfthumb'] = unserialize($list['sfthumb']);
+    foreach ($list['sfthumb'] as &$values) {
+        if (strpos($values, "http") === false) {
+            $values = $_W['attachurl'] . $values;
+        }
+    }
+    // var_dump($list);
+}
+if ($op == 'add') {
+    $openid = $_REQUEST['openid'];
+    $fxinfo = pdo_fetch("SELECT * FROM" . tablename("hyb_o2o_userfenxiao") . " WHERE uniacid=:uniacid and f_openid=:f_openid", array(":uniacid" => $uniacid, ":f_openid" => $openid));
+    if (empty($fxinfo)) {
+        $data = array("uniacid" => $uniacid, "f_openid" => $_REQUEST['openid'], "f_name" => $_REQUEST['f_name'], "f_tel" => $_GPC['f_tel'], "f_address" => $_REQUEST['f_address'], "f_style" => "待审核", "f_time" => date('Y-m-d H:i:s', time()), "f_parentid" => "0", "f_type" => "1", "u_id" => $u_id);
+        pdo_insert("hyb_o2o_userfenxiao", $data);
+    } else {
+        if ($fxinfo['f_type'] == '0') {
+            $datas = array("uniacid" => $uniacid, "f_openid" => $_REQUEST['openid'], "f_name" => $_REQUEST['f_name'], "f_tel" => $_GPC['f_tel'], "f_address" => $_REQUEST['f_address'], "f_type" => "1", "f_style" => "待审核", "u_id" => $u_id);
+        } else {
+            $datas = array("uniacid" => $uniacid, "f_openid" => $_REQUEST['openid'], "f_name" => $_REQUEST['f_name'], "f_tel" => $_GPC['f_tel'], "f_address" => $_REQUEST['f_address'], "f_type" => "1", "u_id" => $u_id);
+        }
+        pdo_update("hyb_o2o_userfenxiao", $datas, array("f_id" => $fxinfo['f_id']));
+    }
+    $userinfo = pdo_fetch("SELECT * from " . tablename("hyb_o2o_userinfo") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+    pdo_update("hyb_o2o_userinfo", array("u_fenxiao" => "1"), array("u_id" => $userinfo['u_id']));
+    output_data("提交成功");
+}
+include $this->template('apply_distributor/apply_distributor');

+ 47 - 0
server/addons/hyb_o2o/inc/mobile/apply_refund.inc.php

xqd
@@ -0,0 +1,47 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$u_id = $_SESSION['u_id'];
+$info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_ordergoods") . " where o_id=:o_id order by o_id desc ", array("o_id" => $_GPC['o_id']));
+if ($op == 'display') {
+    // error_reporting(E_ALL);
+    // var_dump($info);
+}
+if ($op == 'add') {
+    $o_id = $_REQUEST['o_id'];
+    // error_reporting(E_ALL);
+    if (!empty($o_id)) {
+        $data = array();
+        $data['o_type'] = "待退款";
+        // $data['refund_status'] = 1;
+        $data['refund_type'] = $_GPC['refund_type'];
+        $data['refund_body'] = $_GPC['refund_body'];
+        $data['refund_yuanyin'] = $_GPC['refund_yuanyin'];
+        $data['refund_addtime'] = date('Y-m-d H:i:s', time());
+        $data['refund_img'] = serialize($_GPC['imgs']);
+        pdo_update("hyb_o2o_ordergoods", $data, array("o_id" => $o_id));
+        output_data("已提交");
+    }
+}
+if ($op == 'quxiao') {
+    $o_id = $_REQUEST['o_id'];
+    if (!empty($o_id)) {
+        $data = array();
+        $data['o_type'] = "已付款";
+        /*      $data['refund_status'] = 1;
+              $data['refund_type'] = $_GPC['refund_type'];
+              $data['refund_body'] = $_GPC['refund_body'];
+              $data['refund_yuanyin'] = $_GPC['refund_yuanyin'];
+              $data['refund_img'] = serialize($_GPC['imgs']);*/
+        pdo_update("hyb_o2o_ordergoods", $data, array("o_id" => $o_id));
+        output_data("已提交");
+    }
+}
+if ($op == 'edit') {
+    $o_id = $_REQUEST['o_id'];
+    include $this->template('apply_refund/apply_refund2');
+    die;
+}
+include $this->template('apply_refund/apply_refund');

+ 11 - 0
server/addons/hyb_o2o/inc/mobile/barcode_scan.inc.php

xqd
@@ -0,0 +1,11 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$u_id = $_SESSION['u_id'];
+if ($op == 'display') {
+}
+if ($op == 'add') {
+}
+include $this->template('barcode_scan/barcode_scan');

+ 276 - 0
server/addons/hyb_o2o/inc/mobile/base.inc.php

xqd
@@ -0,0 +1,276 @@
+<?php
+
+    //图片上传
+
+        global $_W, $_GPC;  
+        $uniacid = $_W['uniacid'];
+       //查询远程存储
+        $cunchu = pdo_fetch("SELECT * FROM ".tablename("hyb_o2o_cunchu")." where uniacid=:uniacid",array(":uniacid"=>$uniacid));
+        if ($_W['setting']['remote']['type']==0 && $cunchu['type']==0) {   //什么都不开启
+            $uptypes = array('image/jpg', 'image/jpeg', 'image/png', 'image/pjpeg', 'image/gif', 'image/bmp', 'image/x-png');
+            $max_file_size = 2000000;
+            $destination_folder = '../attachment/images/'.$uniacid.'/';  //图片文件夹路径
+            //创建存放图片的文件夹
+            if (!is_dir($destination_folder)) {
+               $res = mkdir($destination_folder, 0777, true);
+            }
+            if (!is_uploaded_file($_FILES['upfile']['tmp_name'])) {
+                echo '图片不存在!';
+                die;
+            }
+            $file = $_FILES['upfile'];
+            if ($max_file_size < $file['size']) {
+                echo '文件太大!';
+                die;
+            }
+            if (!in_array($file['type'], $uptypes)) {
+                echo '文件类型不符!' . $file['type'];
+                die;
+            }
+            $filename = $file['tmp_name'];
+            $pinfo = pathinfo($file['name']);
+            $ftype = $pinfo['extension'];
+            $destination = $destination_folder . str_shuffle(time() . rand(111111, 999999)) . '.' . $ftype;
+            if (file_exists($destination) && $overwrite != true) {
+                echo '同名文件已经存在了';
+                die;
+            }
+            if (!move_uploaded_file($filename, $destination)) {
+                echo '移动文件出错';
+                die;
+            }
+            $pinfo = pathinfo($destination);
+            $fname = $_W['siteroot'].'/attachment/images/'.$uniacid.'/'.$pinfo['basename'];
+            echo $fname;
+        }
+        else if($_W['setting']['remote']['type']==2 && $cunchu['type']==0)    //全局的远程存储 oss
+        {       
+            //将本地图片先上传到服务器
+            load()->func('file');
+            $file = $_FILES['upfile'];
+            $filename = $file['tmp_name'];
+            $destination_folder = '../attachment/images/'.$_W['uniacid'].'/'.date('Y/m/').'/';  //图片文件夹路径
+            //创建存放图片的文件夹
+            if (!is_dir($destination_folder)) {
+               $res = mkdir($destination_folder, 0777, true);
+            }
+            if (!is_uploaded_file($_FILES['upfile']['tmp_name'])) {
+                echo '图片不存在!';
+                die;
+            }
+           
+            $pinfo = pathinfo($file['name']);
+            $ftype = $pinfo['extension'];
+            $destination = $destination_folder . str_shuffle(time() . rand(111111, 999999)) . '.' . $ftype;
+            if (file_exists($destination) && $overwrite != true) {
+                echo '同名文件已经存在了';
+                die;
+            }
+            if (!move_uploaded_file($filename, $destination)) {
+                echo '移动文件出错';
+                die;
+            }
+            $pinfo = pathinfo($destination);
+            $filename = 'images/'.$_W['uniacid'].'/'.date('Y/m/').$pinfo['basename'];
+
+            //将服务器上的图片转移到阿里云oss
+           
+            $remote = $_W['setting']['remote'];
+            require_once(IA_ROOT . '/framework/library/alioss/autoload.php');
+            load()->model('attachment');
+            $endpoint = 'http://'.$remote['alioss']['ossurl'];
+            try {
+                $ossClient = new \OSS\OssClient($remote['alioss']['key'], $remote['alioss']['secret'], $endpoint);              
+                $ossClient->uploadFile($remote['alioss']['bucket'],$filename, ATTACHMENT_ROOT.$filename);
+            } catch (\OSS\Core\OssException $e) {
+              //echo  'error--->'.$e->getMessage();
+                return error(1, $e->getMessage());
+              
+            }
+            if ($auto_delete_local) {
+                unlink($filename);
+            }
+            //删除服务器上的上传文件
+            unlink(ATTACHMENT_ROOT.$filename);
+           $fname = $remote['alioss']['url'].'/'.$filename;
+           echo $fname;
+            
+        }else if($_W['setting']['remote']['type']==3 && $cunchu['type']==0)   //全局的远程存储 七牛云
+        {
+            /*
+                上传文件名       $filekey     $_FILES['upfile']['name']
+                上传文件的路径   $filePath    $_FILES['upfile']['tmp_name']
+                上传凭证         $upToken    
+            */
+             require_once(IA_ROOT . '/framework/library/qiniu/autoload.php');
+             $qiniu = $_W['setting']['remote']['qiniu'];
+             $accessKey=$qiniu['accesskey'];
+             $secretKey=$qiniu['secretkey'];
+             $bucket=$qiniu['bucket'];
+             //转码时使用的队列名称
+             // $pipeline = $qiniu['qn_queuename'];
+              //$pipeline = 'yinyue';
+             //要进行转码的转码操作
+             $fops = "avthumb/mp4/ab/64k/ar/44100/acodec/libfaac";
+             $auth = new Qiniu\Auth($accessKey, $secretKey); 
+
+             $filekey=$_FILES['upfile']['name'];         //上传文件名
+             $filePath=$_FILES['upfile']['tmp_name'];    //上传文件的路径
+
+             //可以对转码后的文件进行使用saveas参数自定义命名,当然也可以不指定文件会默认命名并保存在当间
+             $savekey =  Qiniu\base64_urlSafeEncode($bucket.':'.$filekey.'_1');
+             $fops = $fops.'|saveas/'.$savekey;
+             $policy = array(
+                     'persistentOps' => $fops,
+                     //'persistentPipeline' => $pipeline
+             );
+             $uptoken = $auth->uploadToken($bucket, null, 3600, $policy);    //上传凭证
+             //上传文件的本地路径
+             $uploadMgr = new Qiniu\Storage\UploadManager();
+             $ss = $uploadMgr->putFile($uptoken, $filekey, $filePath);
+             load()->func("logging");
+             $error=logging_run("qiniu:error".$err."成个");
+             if ($err !== null) {
+                 load()->func("logging");
+                 logging_run("qiniu:error");
+                 return false;
+             }
+             $fname=$qiniu['url'].'/'.$ss[0]['key'];
+             echo $fname;
+        }elseif ($_W['setting']['remote']['type']==4 && $cunchu['type']==0) {  //全局的远程存储 腾讯云
+            $cosurl = $_W['setting']['remote']['cos']['url'];
+            $uptypes = array('image/jpg', 'image/jpeg', 'image/png', 'image/pjpeg', 'image/gif', 'image/bmp', 'image/x-png');
+            $max_file_size=2000000;     //上传文件大小限制, 单位BYTE  
+            $destination_folder = '../attachment/images/'.$_W['uniacid'].'/'.date('Y/m/').'/';  //图片文件夹路径
+            if (!is_uploaded_file($_FILES["upfile"]['tmp_name'])) //是否存在文件
+            {
+              echo "图片不存在!";  
+                exit;  
+            }  
+            $file = $_FILES["upfile"];
+            if($max_file_size < $file["size"])
+            {  
+                echo "文件太大!"; 
+                exit;
+            }  
+            if(!in_array($file["type"], $uptypes))   //检查文件类型  
+            {
+                echo "文件类型不符!".$file["type"];
+                exit;
+            }
+            if(!file_exists($destination_folder))
+            {
+              mkdir($destination_folder);
+            }  
+
+            $filename=$file["tmp_name"];  
+            $image_size = getimagesize($filename);  
+            $pinfo=pathinfo($file["name"]);  
+            $ftype=$pinfo['extension'];  
+            $destination = $destination_folder.time().".".$ftype;  
+            if (file_exists($destination) && $overwrite != true)  
+            {  
+                echo "同名文件已经存在了";  
+                exit;  
+            }  
+            if(!move_uploaded_file ($filename, $destination))  
+            {  
+                echo "移动文件出错";  
+                exit;
+            }
+            $pinfo=pathinfo($destination);  
+            $fname=$pinfo['basename'];  
+        
+            @require_once (IA_ROOT . '/framework/function/file.func.php');
+            @$filename='images/'.$_W['uniacid'].'/'.date('Y/m/').'/'.$fname;
+            @file_remote_upload($filename);
+            echo $cosurl.'/images/'.$_W['uniacid'].'/'.date('Y/m/').$fname;
+        }
+        else if ($cunchu['type']==2 && $_W['setting']['remote']['type']==0) {      //模块内的oss
+            //将本地图片先上传到服务器
+            load()->func('file');
+            $file = $_FILES['upfile'];
+            $filename = $file['tmp_name'];
+            $destination_folder = '../attachment/images/'.$_W['uniacid'].'/'.date('Y/m/').'/';  //图片文件夹路径
+            //创建存放图片的文件夹
+            if (!is_dir($destination_folder)) {
+               $res = mkdir($destination_folder, 0777, true);
+            }
+            if (!is_uploaded_file($_FILES['upfile']['tmp_name'])) {
+                echo '图片不存在!';
+                die;
+            }
+            $file = $_FILES['upfile'];
+            $filename = $file['tmp_name'];
+            $pinfo = pathinfo($file['name']);
+            $ftype = $pinfo['extension'];
+            $destination = $destination_folder . str_shuffle(time() . rand(111111, 999999)) . '.' . $ftype;
+            if (file_exists($destination) && $overwrite != true) {
+                echo '同名文件已经存在了';
+                die;
+            }
+            if (!move_uploaded_file($filename, $destination)) {
+                echo '移动文件出错';
+                die;
+            }
+            $pinfo = pathinfo($destination);
+            $filename = 'images/'.$_W['uniacid'].'/'.date('Y/m/').$pinfo['basename'];
+
+            //将服务器上的图片转移到阿里云oss
+            
+            require_once(IA_ROOT . '/framework/library/alioss/autoload.php');
+            load()->model('attachment');
+            $endpoint = 'http://'.$cunchu['alioss_ossurl'];
+            try {
+                $ossClient = new \OSS\OssClient($cunchu['alioss_key'], $cunchu['alioss_secret'], $endpoint);              
+                $ossClient->uploadFile($cunchu['alioss_bucket'],$filename, ATTACHMENT_ROOT.$filename);
+            } catch (\OSS\Core\OssException $e) {
+             // echo  'error--->'.$e->getMessage();
+                return error(1, $e->getMessage());
+              
+            }
+            //删除服务器上的上传文件
+            unlink(ATTACHMENT_ROOT.$filename);
+           $fname = $cunchu['alioss_url'].'/'.$filename;
+           echo $fname;
+        }
+        else if ($cunchu['type']==3 && $_W['setting']['remote']['type']==0) {      //模块内的七牛
+             /*
+                上传文件名       $filekey     $_FILES['upfile']['name']
+                上传文件的路径   $filePath    $_FILES['upfile']['tmp_name']
+                上传凭证         $upToken    
+            */
+             require_once(IA_ROOT . '/framework/library/qiniu/autoload.php');
+             $accessKey=$cunchu['qiniu_accesskey'];
+             $secretKey=$cunchu['qiniu_secretkey'];
+             $bucket=$cunchu['qiniu_bucket'];
+             //转码时使用的队列名称
+             // $pipeline = $qiniu['qn_queuename'];
+              //$pipeline = 'yinyue';
+             //要进行转码的转码操作
+             $fops = "avthumb/mp4/ab/64k/ar/44100/acodec/libfaac";
+             $auth = new Qiniu\Auth($accessKey, $secretKey); 
+
+             $filekey=$_FILES['upfile']['name'];         //上传文件名
+             $filePath=$_FILES['upfile']['tmp_name'];    //上传文件的路径
+
+             //可以对转码后的文件进行使用saveas参数自定义命名,当然也可以不指定文件会默认命名并保存在当间
+             $savekey =  Qiniu\base64_urlSafeEncode($bucket.':'.$filekey.'_1');
+             $fops = $fops.'|saveas/'.$savekey;
+             $policy = array(
+                     'persistentOps' => $fops,
+                     //'persistentPipeline' => $pipeline
+             );
+             $uptoken = $auth->uploadToken($bucket, null, 3600, $policy);    //上传凭证
+             //上传文件的本地路径
+             $uploadMgr = new Qiniu\Storage\UploadManager();
+             $ss = $uploadMgr->putFile($uptoken, $filekey, $filePath);
+             load()->func("logging");
+             $error=logging_run("qiniu:error".$err."成个");
+             if ($err !== null) {
+                 load()->func("logging");
+                 logging_run("qiniu:error");
+                 return false;
+             }
+             $fname=$cunchu['qiniu_url'].'/'.$ss[0]['key'];
+             echo $fname;

+ 11 - 0
server/addons/hyb_o2o/inc/mobile/binding_phone.inc.php

xqd
@@ -0,0 +1,11 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$u_id = $_SESSION['u_id'];
+if ($op == 'display') {
+}
+if ($op == 'add') {
+}
+include $this->template('binding_phone/binding_phone');

+ 10 - 0
server/addons/hyb_o2o/inc/mobile/business_page.inc.php

xqd
@@ -0,0 +1,10 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+if ($op == 'display') {
+}
+if ($op == 'reg') {
+}
+include $this->template('business_page/business_page');

+ 10 - 0
server/addons/hyb_o2o/inc/mobile/business_pages.inc.php

xqd
@@ -0,0 +1,10 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+if ($op == 'display') {
+}
+if ($op == 'reg') {
+}
+include $this->template('business_pages/business_pages');

+ 21 - 0
server/addons/hyb_o2o/inc/mobile/buy_vip.inc.php

xqd
@@ -0,0 +1,21 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$u_id = $_SESSION['u_id'];
+if ($op == 'display') {
+    $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_huiyuan") . " where uniacid=:uniacid", array(":uniacid" => $uniacid));
+    if (!empty($list)) {
+        foreach ($list as &$value) {
+            $value['h_thumb'] = $_W['attachurl'] . $value['h_thumb'];
+            if ($value['h_zhekou'] < 1) {
+                $value['h_zhekou'] = $value['h_zhekou'] * 10;
+            }
+        }
+    }
+    $user_info = pdo_fetch("SELECT u_money FROM " . tablename("hyb_o2o_userinfo") . " where u_id=:u_id and uniacid=:uniacid ", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+}
+if ($op == 'pay') {
+}
+include $this->template('buy_Vip/buy_Vip');

+ 20 - 0
server/addons/hyb_o2o/inc/mobile/card_main.inc.php

xqd
@@ -0,0 +1,20 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+if ($op == 'display') {
+    $c_id = $_REQUEST['c_id'];
+    $info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_cika") . " WHERE uniacid=:uniacid and c_id=:c_id", array(":uniacid" => $uniacid, ":c_id" => $c_id));
+    $info['c_thumb'] = $_W['attachurl'] . $info['c_thumb'];
+    if ($info['c_time'] < 1) {
+        $info['c_times'] = $info['c_time'] * 30;
+        $info['c_timedanwei'] = "天";
+    } else {
+        $info['c_times'] = $info['c_time'];
+        $info['c_timedanwei'] = "个月";
+    }
+}
+if ($op == 'reg') {
+}
+include $this->template('card_main/card_main');

+ 36 - 0
server/addons/hyb_o2o/inc/mobile/cardarr.inc.php

xqd
@@ -0,0 +1,36 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+if ($op == 'display') {
+    $come = $_REQUEST['come'];
+    $x_id = $_REQUEST['x_id'];
+    $s_id = $_REQUEST['s_id'];
+    if ($come == 'fw') {
+        $fuwu = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " WHERE uniacid=:uniacid and x_id=:x_id", array(":uniacid" => $uniacid, ":x_id" => $x_id));
+        $cika = $fuwu['x_cika'];
+        $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_cika") . " WHERE uniacid=:uniacid and c_id in({$cika}) order by c_ids desc ", array(":uniacid" => $uniacid));
+    } else {
+        $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_cika") . " WHERE uniacid=:uniacid and shangjia=:shangjia order by c_ids desc ", array(":uniacid" => $uniacid, ":shangjia" => $s_id));
+    }
+    //次卡背景图
+    $base = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_base") . " WHERE uniacid=:uniacid", array(":uniacid" => $uniacid));
+    $info['cikathumb'] = $_W['attachurl'] . $base['cikathumb'];
+    if (!empty($list)) {
+        foreach ($list as &$value) {
+            $value['c_thumb'] = $_W['attachurl'] . $value['c_thumb'];
+            if ($value['c_time'] < 1) {
+                $value['c_times'] = $value['c_time'] * 30;
+                $value['c_timedanwei'] = "天";
+            } else {
+                $value['c_times'] = $value['c_time'];
+                $value['c_timedanwei'] = "个月";
+            }
+        }
+    }
+    $info['list'] = $list;
+}
+if ($op == 'reg') {
+}
+include $this->template('cardArr/cardArr');

+ 54 - 0
server/addons/hyb_o2o/inc/mobile/cardwrap.inc.php

xqd
@@ -0,0 +1,54 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$u_id = $_SESSION['u_id'];
+if ($op == 'display') {
+    // $yhj_list = pdo_fetchall("SELECT a.*,b.* FROM ".tablename("hyb_o2o_useryouhuiquan")." as a left join  ".tablename("hyb_o2o_youhuiquan")." as b on a.y_name=b.y_id where a.u_id=:u_id and a.uniacid=:uniacid ",array(":uniacid"=>$uniacid,":u_id"=>$u_id));
+    // error_reporting(E_ALL);
+    $openid = $_REQUEST['openid'];
+    $newtime = date("Y-m-d H:i:s", time());
+    $yhq = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_useryouhuiquan") . " WHERE uniacid=:uniacid and u_id=:u_id and y_endtime>=:y_endtime and type=:type", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":type" => "未使用", ":y_endtime" => $newtime));
+    if (!empty($yhq)) {
+        foreach ($yhq as &$value1) {
+            $info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_youhuiquan") . " WHERE uniacid=:uniacid and y_id=:y_id", array(":uniacid" => $uniacid, ":y_id" => $value1['y_name']));
+            if ($info['y_status'] == '0') {
+                $y_shiyong = "仅限商品购买使用";
+                $value1['tiao'] = "goodslist";
+            } else {
+                $fuwu = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu") . "WHERE uniacid=:uniacid and x_id=:x_id", array(":uniacid" => $uniacid, ":x_id" => $value1['x_id']));
+                if (empty($fuwu)) {
+                    $value1['tiao'] = "all";
+                } else {
+                    $value1['tiao'] = "detail";
+                }
+                $y_shiyong = "仅限服务" . $fuwu['x_name'] . "使用";
+            }
+            $value1['y_name'] = $info['y_name'];
+            $value1['y_money'] = $info['y_money'];
+            $value1['y_shuoming'] = $info['y_shuoming'];
+            $value1['y_yaoqiu'] = $info['y_yaoqiu'];
+            $value1['y_endtime'] = $info['y_endtime'];
+            $value1['y_shiyong'] = $y_shiyong;
+            $value1['y_status'] = $info['y_status'];
+        }
+    }
+    $cika = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_usercika") . " WHERE uniacid=:uniacid and u_id=:u_id and synum>0 and cendtime>=:time", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":time" => $newtime));
+    if (!empty($cika)) {
+        foreach ($cika as &$value2) {
+            $info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_cika") . " WHERE uniacid=:uniacid and c_id=:c_id", array(":uniacid" => $uniacid, ":c_id" => $value2['cid']));
+            $value2['c_name'] = $info['c_name'];
+            $value2['c_thumb'] = $_W['attachurl'] . $info['c_thumb'];
+            $value2['c_money'] = $info['c_money'];
+            $value2['c_kahao'] = $info['c_kahao'];
+            $value2['c_time'] = substr($value2['time'], 0, strrpos($value2['time'], " "));
+            $value2['c_kcnum'] = $value2['countnum'] - $value2['synum'];
+        }
+    }
+    $list['yhq'] = $yhq;
+    $list['cika'] = $cika;
+}
+if ($op == 'reg') {
+}
+include $this->template('cardWrap/cardWrap');

+ 10 - 0
server/addons/hyb_o2o/inc/mobile/changeword.inc.php

xqd
@@ -0,0 +1,10 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+if ($op == 'display') {
+}
+if ($op == 'reg') {
+}
+include $this->template('changeWord/changeWord');

+ 33 - 0
server/addons/hyb_o2o/inc/mobile/deposit_record.inc.php

xqd
@@ -0,0 +1,33 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$u_id = $_SESSION['u_id'];
+if ($op == 'display') {
+}
+if ($op == 'tixanlist') {
+    //doPageTixanlist
+    $typs = $_REQUEST['typs'];
+    $cur = $_REQUEST['cur'];
+    if ($typs == 'yh') {
+        //查询用户
+        $user = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " WHERE uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+        if ($cur == '0') {
+            $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_usertixian") . " WHERE uniacid=:uniacid and u_id=:u_id and statue=:statue order by time desc ", array(":uniacid" => $uniacid, ":u_id" => $user['u_id'], ":statue" => "待提现"));
+        }
+        if ($cur == '1') {
+            $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_usertixian") . " WHERE uniacid=:uniacid and u_id=:u_id and statue=:statue order by time desc ", array(":uniacid" => $uniacid, ":u_id" => $user['u_id'], ":statue" => "已提现"));
+        }
+        if ($cur == '2') {
+            $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_usertixian") . " WHERE uniacid=:uniacid and u_id=:u_id and statue=:statue order by time desc ", array(":uniacid" => $uniacid, ":u_id" => $user['u_id'], ":statue" => "已拒绝"));
+            if (!empty($list)) {
+                foreach ($list as &$value) {
+                    $value['countmoney'] = $value['money'] + $value['s_money'];
+                }
+            }
+        }
+    }
+    output_data($list);
+}
+include $this->template('deposit_record/deposit_record');

+ 2 - 0
server/addons/hyb_o2o/inc/mobile/deposit_rocord.inc.php

xqd
@@ -0,0 +1,2 @@
+<?php
+

+ 174 - 0
server/addons/hyb_o2o/inc/mobile/detail.inc.php

xqd
@@ -0,0 +1,174 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$u_id = $_SESSION['u_id'];
+if ($op == 'display') {
+    //
+    // error_reporting(E_ALL);
+    $x_id = $_REQUEST['x_id'];
+    $openid = $_REQUEST['openid'];
+    $list = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " where uniacid=:uniacid and x_id=:x_id", array(":uniacid" => $uniacid, ":x_id" => $x_id));
+    if (strpos($list['x_thumb'], "http") === false) {
+        $list['x_thumb'] = $_W['attachurl'] . $list['x_thumb'];
+    }
+    $list['x_thumbs'] = unserialize($list['x_thumbs']);
+    foreach ($list['x_thumbs'] as &$value) {
+        if (strpos($value, "http") === false) {
+            $value = $_W['attachurl'] . $value;
+        }
+    }
+    $list['x_guigecontent'] = unserialize($list['x_guigecontent']);
+    /*权益*/
+    //会员权益
+    //查询当前用户会员权益
+    $newtime = date("Y-m-d H:i:s", time());
+    $user = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+    $mrhy = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_huiyuanset") . " WHERE uniacid=:uniacid", array(":uniacid" => $uniacid));
+    //查询会员卡是否存在
+    $userhuiyuan = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_huiyuan") . " WHERE uniacid=:uniacid and h_id=:h_id", array(":uniacid" => $uniacid, ":h_id" => $user['u_type']));
+    if ($user['u_type'] == '0') {
+        //引导办理会员
+        $huiyuan['banli'] = "true";
+        //需要办理
+        $huiyuan['hname'] = $mrhy['hname'];
+        //会员卡名称
+        $huiyuan['hmoney'] = $mrhy['hmrkk'];
+        //办理费用
+        $huiyuan['hxmoney'] = number_format($list['x_jiage'] * $mrhy['hmrzk'], 2);
+        $huiyuan['hsmoney'] = number_format($list['x_jiage'] * (1 - $mrhy['hmrzk']), 2);
+        $huiyuan['tishi'] = "立即开通";
+    } else {
+        if (empty($userhuiyuan)) {
+            //引导办理会员
+            $mrhy = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_huiyuanset") . " WHERE uniacid=:uniacid", array(":uniacid" => $uniacid));
+            $huiyuan['banli'] = "true";
+            //需要办理
+            $huiyuan['hname'] = $mrhy['hname'];
+            //会员卡名称
+            $huiyuan['hmoney'] = $mrhy['hmrkk'];
+            //办理费用
+            $huiyuan['hxmoney'] = number_format($list['x_jiage'] * $mrhy['hmrzk'], 2);
+            $huiyuan['hsmoney'] = number_format($list['x_jiage'] * (1 - $mrhy['hmrzk']), 2);
+            $huiyuan['tishi'] = "立即开通";
+        } else {
+            if ($user['u_typeendtime'] < $newtime) {
+                $huiyuan['banli'] = "false";
+                //需要办理
+                $huiyuan['hname'] = $mrhy['hname'];
+                //会员卡名称
+                $huiyuan['hmoney'] = $userhuiyuan['h_money'];
+                //办理费用
+                if ($userhuiyuan['h_zhekou'] > 1) {
+                    $userhuiyuanzhekou = $userhuiyuan['h_zhekou'] * 0.1;
+                } else {
+                    $userhuiyuanzhekou = $userhuiyuan['h_zhekou'];
+                }
+                $huiyuan['hxmoney'] = number_format($list['x_jiage'] * $userhuiyuanzhekou, 2);
+                $huiyuan['hsmoney'] = number_format($list['x_jiage'] * (1 - $userhuiyuanzhekou), 2);
+                $huiyuan['tishi'] = "前往续费";
+            } else {
+                $huiyuan['banli'] = "false";
+                //需要办理
+                $huiyuan['hname'] = $mrhy['hname'];
+                //会员卡名称
+                $huiyuan['hmoney'] = $userhuiyuan['h_money'];
+                //办理费用
+                if ($userhuiyuan['h_zhekou'] > 1) {
+                    $userhuiyuanzhekou = $userhuiyuan['h_zhekou'] * 0.1;
+                } else {
+                    $userhuiyuanzhekou = $userhuiyuan['h_zhekou'];
+                }
+                $huiyuan['hxmoney'] = number_format($list['x_jiage'] * $userhuiyuanzhekou, 2);
+                $huiyuan['hsmoney'] = number_format($list['x_jiage'] * (1 - $userhuiyuanzhekou), 2);
+                $huiyuan['tishi'] = "查看详情";
+            }
+        }
+    }
+    $list['huiyuan'] = $huiyuan;
+    // var_dump($list);die;
+    //次卡权益
+    if ($list['x_cikastatus'] == '1') {
+        //查询次卡
+        $fwck = $list['x_cika'];
+        if (empty($fwck)) {
+            $cika['banli'] = "false";
+            //不展示
+        } else {
+            $cika['banli'] = "true";
+            //展示
+        }
+    } else {
+        $cika['banli'] = "false";
+        //不展示
+    }
+    $list['cika'] = $cika;
+    if ($list['x_youhuiquanstatus'] == "1") {
+        $youhuiquan = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_youhuiquan") . " where uniacid=:uniacid and y_id=:y_id and y_status=:y_status and y_endtime>=:time and y_starttime<=:time", array(":uniacid" => $uniacid, ":y_id" => $list['x_youhuiquan'], ":time" => $newtime, ":y_status" => 1));
+        if (!empty($youhuiquan)) {
+            $youhuiquan['y_moneys'] = intval($youhuiquan['y_money']);
+            $list['youhuiquan'] = $youhuiquan;
+            $list['youhuiquanlq'] = "true";
+            //查询是否领取了优惠券
+            $useryouhuiquan = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_useryouhuiquan") . " where uniacid=:uniacid and x_id=:x_id and y_name=:y_name and u_id=:u_id", array(":uniacid" => $uniacid, ":x_id" => $list['x_id'], ":y_name" => $youhuiquan['y_id'], ":u_id" => $u_id));
+            if (empty($useryouhuiquan)) {
+                $list['youhuiquan']['lingdone'] = false;
+                //可领取
+            } else {
+                $list['youhuiquan']['lingdone'] = true;
+                //已领取
+            }
+        } else {
+            $list['youhuiquanlq'] = "false";
+            $list['youhuiquan']['lingdone'] = true;
+            //已领取
+            $list['useryouhuiquan'] = $useryouhuiquan;
+        }
+    }
+    /*保障*/
+    //查询商家
+    $shangjia = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " where uniacid=:uniacid and s_id=:s_id", array(":uniacid" => $uniacid, ":s_id" => $list['x_shangjia']));
+    $list['s_name'] = $shangjia['s_name'];
+    if (!empty($shangjia['baozhang'])) {
+        $list['baozhang'] = unserialize($shangjia['baozhang']);
+    } else {
+        $list['baozhang'] = [];
+    }
+    /*评价*/
+    $pingjia = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwupingjia") . " where uniacid=:uniacid and p_sid=:p_sid order by p_id desc ", array(":uniacid" => $uniacid, ":p_sid" => $list['x_id']));
+    if (!empty($pingjia)) {
+        foreach ($pingjia as &$p) {
+            $p['p_name'] = json_decode($p['p_name']);
+            $p['p_pic'] = unserialize($p['p_pic']);
+        }
+        $list['pingjia'] = $pingjia;
+    }
+    //查询商家员工
+    $yaungong = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_yuangong") . " where uniacid=:uniacid and y_sjname=:y_sjname and y_styles=:y_styles and y_typs=:y_typs and y_jin=0 and y_rz=0", array(":uniacid" => $uniacid, ":y_sjname" => $shangjia['s_id'], ":y_styles" => "审核通过", ":y_typs" => "空闲中"));
+    if (!empty($yaungong)) {
+        foreach ($yaungong as &$values) {
+            $values['y_jineng'] = unserialize($values['y_jineng']);
+            if (strpos($values['y_thumb'], "http") === false) {
+                $values['y_thumb'] = $_W['attachurl'] . $values['y_thumb'];
+            }
+            $values['y_fwqy'] = unserialize($values['y_fwqy']);
+            $values['fuwuquyu'] = implode(",", $values['y_fwqy']);
+            //查询接单数
+            $jiedan = pdo_fetchcolumn("SELECT count(*) FROM " . tablename("hyb_o2o_orderfuwu") . " WHERE uniacid=:uniacid and o_fwry_id=:o_fwry_id", array(":uniacid" => $uniacid, ":o_fwry_id" => $values['y_id']));
+            $values['jiedan'] = $jiedan;
+            //查询服务评分
+            $fwpf = pdo_fetchall("SELECT count(*) as pingjianum,num(p_fenshu) as pingfe FROM " . tablename("hyb_o2o_fuwupingjia") . " WHERE uniacid=:uniacid and p_yid=:p_yid", array(":uniacid" => $uniacid, ":p_yid" => $values['y_id']));
+            $pingfen = $fwpf[0]['pingfe'] / $orderpingfen[0]['pingjianum'];
+            if ($pingfen == '0') {
+                $values['pingfen'] = 5;
+            } else {
+                $values['pingfen'] = ceil($pingfen);
+            }
+        }
+    }
+    $list['yuangong'] = array_values($yaungong);
+    $wxinfo = $this->getSignPackage();
+    // var_dump($list);
+    include $this->template('detail/detail');
+}

+ 11 - 0
server/addons/hyb_o2o/inc/mobile/detail.php

xqd
@@ -0,0 +1,11 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+error_reporting(E_ALL);
+if ($op == 'display') {
+}
+if ($op == 'reg') {
+}
+include $this->template('detail/detail');

+ 207 - 0
server/addons/hyb_o2o/inc/mobile/distributer_page.inc.php

xqd
@@ -0,0 +1,207 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$id = $u_id = $_SESSION['u_id'];
+if ($op == 'display') {
+    $info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+    $tixian_sys = pdo_fetch("SELECT * from " . tablename("hyb_o2o_tixian") . " WHERE uniacid=:uniacid", array(":uniacid" => $uniacid));
+    $tixian_sum = pdo_fetch("SELECT sum(money) as tixian FROM " . tablename("hyb_o2o_usertixian") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+}
+if ($op == 'Paytixian') {
+    $t_money = $_REQUEST['t_money'];
+    $tishi = $_REQUEST['tishi'];
+    $typs = $_REQUEST['typs'];
+    $tixian_sys = pdo_fetch("SELECT * from " . tablename("hyb_o2o_tixian") . " WHERE uniacid=:uniacid", array(":uniacid" => $uniacid));
+    $shouxufei = $t_money * $tixian_sys['shouxufei'] / 100;
+    if ($typs == "yh") {
+        //查询用户
+        $user = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $id));
+        $u_money = $user['u_money'];
+        if ($tishi == "1") {
+            //不够手续费
+            //商户余额
+            $moneyss = $u_money - $t_money;
+            $moneys = round($moneyss, 2);
+            //提现金额
+            $moneyt = $t_money - $shouxufei;
+            $data = array("u_money" => $moneys);
+            pdo_update("hyb_o2o_userinfo", $data, array("u_id" => $id));
+            $data2 = array("uniacid" => $uniacid, "u_id" => $id, 's_money' => $shouxufei, "money" => $moneyt, "statue" => "待提现", "tnum" => date('Ymd') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT), "time" => date("Y-m-d H:i:s", time()));
+            if ($_REQUEST['xingshi'] == "0") {
+                $data2['xingshi'] = "银行卡";
+                $data2['zhanghao'] = $_REQUEST['cardNum'];
+                $data2['xingming'] = $_REQUEST['name'];
+                $data2['kaihuhang'] = $_REQUEST['place'];
+            }
+            if ($_REQUEST['xingshi'] == '1') {
+                $data2['xingshi'] = "支付宝";
+                $data2['xingming'] = $_REQUEST['name'];
+                $data2['zhanghao'] = $_REQUEST['cardNum'];
+            }
+            if ($_REQUEST['xingshi'] == '2') {
+                $data2['xingshi'] = "微信";
+            }
+            $save = pdo_insert("hyb_o2o_usertixian", $data2);
+        } else {
+            //商户余额
+            $moneyss = $u_money - $t_money - $shouxufei;
+            $data = array("u_money" => $moneyss);
+            pdo_update("hyb_o2o_userinfo", $data, array("u_id" => $id));
+            $data2 = array("uniacid" => $uniacid, "u_id" => $id, 's_money' => $shouxufei, "money" => $t_money, "statue" => "待提现", "tnum" => date('Ymd') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT), "time" => date("Y-m-d H:i:s", time()));
+            if ($_REQUEST['xingshi'] == "0") {
+                $data2['xingshi'] = "银行卡";
+                $data2['zhanghao'] = $_REQUEST['cardNum'];
+                $data2['xingming'] = $_REQUEST['name'];
+                $data2['kaihuhang'] = $_REQUEST['place'];
+            }
+            if ($_REQUEST['xingshi'] == '1') {
+                $data2['xingshi'] = "支付宝";
+                $data2['xingming'] = $_REQUEST['name'];
+                $data2['zhanghao'] = $_REQUEST['cardNum'];
+            }
+            if ($_REQUEST['xingshi'] == '2') {
+                $data2['xingshi'] = "微信";
+            }
+            $save = pdo_insert("hyb_o2o_usertixian", $data2);
+        }
+    }
+    /*        if ($typs =='sj') {
+             //查询商家
+              $shangjia = pdo_fetch("SELECT * FROM ".tablename("hyb_o2o_shangjia")." where uniacid=:uniacid and s_id=:s_id",array(":uniacid"=>$uniacid,":s_id"=>$id));
+              $s_money = $shangjia['s_money'];
+              if($tishi=="1"){  //不够手续费
+                //商户余额
+                $moneyss = $s_money-$t_money;
+                $moneys =round($moneyss, 2); ;
+                //提现金额
+                $moneyt = $t_money-$shouxufei;
+                $data = array("s_money"=>$moneys);
+                pdo_update("hyb_o2o_shangjia",$data,array("s_id"=>$id));
+                $data2 = array(
+                    "uniacid"=>$uniacid,
+                    "s_id"=>$id,
+                    's_money'=>$shouxufei,
+                    "money"=>$moneyt,
+                    "statue"=>"待提现",
+                    "tnum"=>date('Ymd').str_pad(mt_rand(1, 99999),5,'0',STR_PAD_LEFT),
+                    "time"=>date("Y-m-d H:i:s",time()),
+                );
+                if ($_REQUEST['xingshi']=="0") {
+                    $data2['xingshi'] = "银行卡";
+                    $data2['zhanghao'] = $_REQUEST['cardNum'];
+                    $data2['xingming'] = $_REQUEST['name'];
+                    $data2['kaihuhang'] = $_REQUEST['place'];
+                }
+                if ($_REQUEST['xingshi']=='1') {
+                    $data2['xingshi'] = "支付宝";
+                    $data2['xingming'] = $_REQUEST['name'];
+                    $data2['zhanghao'] = $_REQUEST['cardNum'];
+                }
+                if ($_REQUEST['xingshi']=='2') {
+                    $data2['xingshi'] = "微信";
+                }
+                $save = pdo_insert("hyb_o2o_usertixian",$data2);
+              }else{
+                //商户余额
+                $moneyss = $s_money-$t_money-$shouxufei;
+                $data = array("s_money"=>$moneyss);
+                pdo_update("hyb_o2o_shangjia",$data,array("s_id"=>$id));
+                $data2 = array(
+                    "uniacid"=>$uniacid,
+                    "s_id"=>$id,
+                    's_money'=>$shouxufei,
+                    "money"=>$t_money,
+                    "statue"=>"待提现",
+                    "tnum"=>date('Ymd').str_pad(mt_rand(1, 99999),5,'0',STR_PAD_LEFT),
+                    "time"=>date("Y-m-d H:i:s",time()),
+                );
+                if ($_REQUEST['xingshi']=="0") {
+                    $data2['xingshi'] = "银行卡";
+                    $data2['zhanghao'] = $_REQUEST['cardNum'];
+                    $data2['xingming'] = $_REQUEST['name'];
+                    $data2['kaihuhang'] = $_REQUEST['place'];
+                }
+                if ($_REQUEST['xingshi']=='1') {
+                    $data2['xingshi'] = "支付宝";
+                    $data2['xingming'] = $_REQUEST['name'];
+                    $data2['zhanghao'] = $_REQUEST['cardNum'];
+                }
+                if ($_REQUEST['xingshi']=='2') {
+                    $data2['xingshi'] = "微信";
+                }
+                $save = pdo_insert("hyb_o2o_usertixian",$data2);
+              }
+            }
+            if ($typs=='yg') {
+                //查询员工
+                $yuangong  = pdo_fetch("SELECT * FROM ".tablename("hyb_o2o_yuangong")." WHERE uniacid=:uniacid and y_id=:y_id",array(":uniacid"=>$uniacid,":y_id"=>$id));
+                $y_money = $yuangong['y_money'];
+              if($tishi=="1"){  //不够手续费
+                //商户余额
+                $moneyss = $y_money-$t_money;
+                $moneys =round($moneyss, 2); ;
+                //提现金额
+                $moneyt = $t_money-$shouxufei;
+                $data = array("y_money"=>$moneys);
+                pdo_update("hyb_o2o_yuangong",$data,array("y_id"=>$id));
+                $data2 = array(
+                    "uniacid"=>$uniacid,
+                    "y_id"=>$id,
+                    's_money'=>$shouxufei,
+                    "money"=>$moneyt,
+                    "statue"=>"待提现",
+                    "tnum"=>date('Ymd').str_pad(mt_rand(1, 99999),5,'0',STR_PAD_LEFT),
+                    "time"=>date("Y-m-d H:i:s",time()),
+                );
+                if ($_REQUEST['xingshi']=="0") {
+                    $data2['xingshi'] = "银行卡";
+                    $data2['zhanghao'] = $_REQUEST['cardNum'];
+                    $data2['xingming'] = $_REQUEST['name'];
+                    $data2['kaihuhang'] = $_REQUEST['place'];
+                }
+                if ($_REQUEST['xingshi']=='1') {
+                    $data2['xingshi'] = "支付宝";
+                    $data2['xingming'] = $_REQUEST['name'];
+                    $data2['zhanghao'] = $_REQUEST['cardNum'];
+                }
+                if ($_REQUEST['xingshi']=='2') {
+                    $data2['xingshi'] = "微信";
+                }
+                $save = pdo_insert("hyb_o2o_usertixian",$data2);
+              }else{
+                //商户余额
+                $moneyss = $y_money-$t_money-$shouxufei;
+                $data = array("y_money"=>$moneyss);
+                pdo_update("hyb_o2o_yuangong",$data,array("y_id"=>$id));
+                $data2 = array(
+                    "uniacid"=>$uniacid,
+                    "y_id"=>$id,
+                    's_money'=>$shouxufei,
+                    "money"=>$t_money,
+                    "statue"=>"待提现",
+                    "tnum"=>date('Ymd').str_pad(mt_rand(1, 99999),5,'0',STR_PAD_LEFT),
+                    "time"=>date("Y-m-d H:i:s",time()),
+                );
+                if ($_REQUEST['xingshi']=="0") {
+                    $data2['xingshi'] = "银行卡";
+                    $data2['zhanghao'] = $_REQUEST['cardNum'];
+                    $data2['xingming'] = $_REQUEST['name'];
+                    $data2['kaihuhang'] = $_REQUEST['place'];
+                }
+                if ($_REQUEST['xingshi']=='1') {
+                    $data2['xingshi'] = "支付宝";
+                    $data2['xingming'] = $_REQUEST['name'];
+                    $data2['zhanghao'] = $_REQUEST['cardNum'];
+                }
+                if ($_REQUEST['xingshi']=='2') {
+                    $data2['xingshi'] = "微信";
+                }
+                $save = pdo_insert("hyb_o2o_usertixian",$data2);
+              }
+            }*/
+    //return $this->result(0,"success",$shuju);
+    output_data("提现申请成功");
+}
+include $this->template('distributer_page/distributer_page');

+ 43 - 0
server/addons/hyb_o2o/inc/mobile/employ_page.inc.php

xqd
@@ -0,0 +1,43 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+if ($op == 'display') {
+    // error_reporting(E_ALL);
+    $x_id = $_REQUEST['x_id'];
+    //查询项目
+    $list = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " where uniacid=:uniacid and x_id=:x_id", array(":uniacid" => $uniacid, ":x_id" => $x_id));
+    //后面代码同上面的代码一样
+    /*
+            //查询商家*/
+    $shangjia = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " where uniacid=:uniacid and s_id=:s_id", array(":uniacid" => $uniacid, ":s_id" => $list['x_shangjia']));
+    //查询商家员工
+    $yaungong = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_yuangong") . " where uniacid=:uniacid and y_sjname=:y_sjname and y_styles=:y_styles and y_typs=:y_typs and y_jin=0 and y_rz=0", array(":uniacid" => $uniacid, ":y_sjname" => $shangjia['s_id'], ":y_styles" => "审核通过", ":y_typs" => "空闲中"));
+    // var_dump($yaungong);
+    if (!empty($yaungong)) {
+        foreach ($yaungong as &$values) {
+            $values['y_jineng'] = unserialize($values['y_jineng']);
+            if (strpos($values['y_thumb'], "http") === false) {
+                $values['y_thumb'] = $_W['attachurl'] . $values['y_thumb'];
+            }
+            $values['y_fwqy'] = unserialize($values['y_fwqy']);
+            $values['fuwuquyu'] = implode(",", $values['y_fwqy']);
+            //查询接单数
+            $jiedan = pdo_fetchcolumn("SELECT count(*) FROM " . tablename("hyb_o2o_orderfuwu") . " WHERE uniacid=:uniacid and o_fwry_id=:o_fwry_id", array(":uniacid" => $uniacid, ":o_fwry_id" => $values['u_id']));
+            $values['jiedan'] = $jiedan;
+            //查询服务评分
+            $fwpf = pdo_fetchall("SELECT count(*) as pingjianum,num(p_fenshu) as pingfe FROM " . tablename("hyb_o2o_fuwupingjia") . " WHERE uniacid=:uniacid and p_yid=:p_yid", array(":uniacid" => $uniacid, ":p_yid" => $values['y_id']));
+            $pingfen = $fwpf[0]['pingfe'] / $orderpingfen[0]['pingjianum'];
+            if ($pingfen == '0') {
+                $values['pingfen'] = 5;
+            } else {
+                $values['pingfen'] = ceil($pingfen);
+            }
+        }
+    }
+    // var_dump($yaungong);
+    // output_data(array_values($yaungong));
+    $yaungong = array_values($yaungong);
+}
+include $this->template('employ_page/employ_page');

+ 13 - 0
server/addons/hyb_o2o/inc/mobile/fa_detail.inc.php

xqd
@@ -0,0 +1,13 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$u_id = $_SESSION['u_id'];
+if ($op == 'display') {
+    //doPageFadanxq
+    $fa_id = $_REQUEST['fa_id'];
+    $info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fadan") . " WHERE uniacid=:uniacid and fa_id=:fa_id", array(":uniacid" => $uniacid, ":fa_id" => $fa_id));
+    $info['fa_fwimgpath'] = unserialize($info['fa_fwimgpath']);
+}
+include $this->template('fa_detail/fa_detail');

+ 29 - 0
server/addons/hyb_o2o/inc/mobile/fabu.inc.php

xqd
@@ -0,0 +1,29 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$fuwu_mode = m("fuwu");
+if ($op == 'display') {
+    // $list = pdo_fetchall("SELECT * FROM ".tablename("hyb_o2o_fuwu_type")." where uniacid=:uniacid and xt_parentid=0 order by xt_ids desc ",array(":uniacid"=>$uniacid));
+    $list = $fuwu_mode->getAll_tpye('*', 'xt_parentid=0', array(":uniacid" => $uniacid));
+    if (!empty($list)) {
+        foreach ($list as $key => $value) {
+            if (strpos($value['xt_thumb'], "http") === false) {
+                $list[$key]['xt_thumb'] = $_W['attachurl'] . $value['xt_thumb'];
+            }
+            $erji = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_parentid=:xt_parentid", array(":uniacid" => $uniacid, ":xt_parentid" => $value['xt_id']));
+            if (!empty($erji)) {
+                foreach ($erji as &$values) {
+                    if (strpos($values['xt_thumb'], "http") === false) {
+                        $values['xt_thumb'] = $_W['attachurl'] . $values['xt_thumb'];
+                    }
+                }
+                $list[$key]['erji'] = $erji;
+            } else {
+                unset($list[$key]);
+            }
+        }
+    }
+}
+include $this->template('fabu/fabu');

+ 468 - 0
server/addons/hyb_o2o/inc/mobile/fabu_main.inc.php

xqd
@@ -0,0 +1,468 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$u_id = $_SESSION['u_id'];
+if ($op == 'display') {
+    //getErjiPrice
+    $wxinfo = $this->getSignPackage();
+    // var_dump($wxinfo);
+    $type_id = !empty($_GPC['xt_id']) ? $_GPC['xt_id'] : "20";
+    $type_info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " WHERE uniacid=:uniacid and xt_id=:xt_id ", array(":uniacid" => $uniacid, ":xt_id" => $type_id));
+    $parent_info = pdo_fetch("SELECT xt_name FROM " . tablename("hyb_o2o_fuwu_type") . " WHERE uniacid=:uniacid and xt_id=:xt_id ", array(":uniacid" => $uniacid, ":xt_id" => $type_info['xt_parentid']));
+    /*        $data['price'] = $type_info['xt_reference_price'];
+            $data['smfy'] = $type_info['xt_smreference_price'];*/
+    $type_info['parent_name'] = $parent_info['xt_name'];
+}
+if ($op == 'add') {
+    $_REQUEST['dizhi'] = $_COOKIE['city'];
+    /*      $imgpath = str_replace('"',"",str_replace("]","",str_replace("[","", $_REQUEST['imglist'])));
+          $imgpath = explode(",",$imgpath);*/
+    $imgpath = serialize($_REQUEST['imglist']);
+    $user = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " WHERE uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+    $data = array(
+        "u_id" => $u_id,
+        "uniacid" => $uniacid,
+        "fa_ordersn" => date("Ymd") . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT),
+        "fa_openid" => $user['openid'],
+        "fa_name" => $_REQUEST['name'],
+        //联系人
+        "fa_fwname" => $_REQUEST['server_name'],
+        //服务名称
+        "fa_fwimgpath" => $imgpath,
+        "fa_fwstyle1" => $_REQUEST['fenlei_one'],
+        //服务分类
+        "fa_fwstyle2" => $_REQUEST['fenlei_two'],
+        //服务分类二
+        "fa_fwtime" => $_REQUEST['fa_fwtime'],
+        //服务时间
+        "fa_fwmoney" => $_REQUEST['money'],
+        //服务金额
+        "fa_dizhi" => $_REQUEST['dizhi'],
+        //地址
+        "fa_fwaddress" => $_REQUEST['location'],
+        //服务地址
+        "fa_fwaddresss" => $_REQUEST['address_detail'],
+        //服务详细地址
+        "fa_fwlongitude" => $_REQUEST['longitude'],
+        //经纬度
+        "fa_fwlatitude" => $_REQUEST['latitude'],
+        "fa_fwcontent" => $_REQUEST['server_intro'],
+        //服务备注
+        "fa_fwtelphone" => $_REQUEST['telphone'],
+        //服务联系电话
+        "fa_fwpay_type" => $_REQUEST['server_charge'],
+        //支付形式
+        "fa_time" => date("Y-m-d H:i:s", time()),
+    );
+    //支付后操作
+    //查询用户
+    if ($_REQUEST['server_charge'] == "一口价") {
+        $data['fa_fwpay_types'] = "1";
+        $data['fa_fwshagneng'] = "0";
+        /*          if ($_REQUEST['paytype']=="余额支付") {
+            $u_money = $user['u_money']-$_REQUEST['money'];
+            pdo_update("hyb_o2o_userinfo",array("u_money"=>$u_money),array("u_id"=>$user['u_id']));
+            }*/
+    }
+    if ($_REQUEST['server_charge'] == "上门估价") {
+        $data['fa_fwmoney'] = "0";
+        $data['fa_fwpay_types'] = "0";
+        $data['fa_fwshagneng'] = $_REQUEST['smfy'];
+        /*          if ($_REQUEST['paytype']=="余额支付") {
+            $u_money = $user['u_money']-$_REQUEST['smfy'];
+            pdo_update("hyb_o2o_userinfo",array("u_money"=>$u_money),array("u_id"=>$user['u_id']));
+            } */
+    }
+    $data["fa_style"] = "未支付";
+    pdo_insert("hyb_o2o_fadan", $data);
+    $f_id = pdo_insertid();
+    output_data(['f_id' => $f_id]);
+    die;
+    //查审核开关
+    $base = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_base") . " WHERE uniacid=:uniacid", array(":uniacid" => $uniacid));
+    require_once dirname(__FILE__) . '/../../inc/func/SignatureHelper.php';
+    $aliduanxin = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_news") . " WHERE uniacid=:uniacid ", array("uniacid" => $uniacid));
+    $accessKeyId = $aliduanxin['accessKeyId'];
+    $accessKeySecret = $aliduanxin['accessKeySecret'];
+    if ($base['fdsh_type'] == '0') {
+        $data["fa_style"] = "待审核";
+        $res = pdo_insert("hyb_o2o_fadan", $data);
+        //查询平台信息
+        $pingtai = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " WHERE uniacid=:uniacid and pingtai=1", array(":uniacid" => $uniacid));
+        //通知平台审核
+        $params = array();
+        $params["PhoneNumbers"] = $pingtai['s_telphone'];
+        //接收人手机号
+        $params["SignName"] = $aliduanxin['SignName'];
+        $params["TemplateCode"] = $aliduanxin['fdtz'];
+        $params['TemplateParam'] = array('name' => $pingtai['s_name'], "product" => "sms");
+        if (!empty($params["TemplateParam"]) && is_array($params["TemplateParam"])) {
+            $params["TemplateParam"] = json_encode($params["TemplateParam"]);
+        }
+        $helper = new SignatureHelper();
+        $content = $helper->request($accessKeyId, $accessKeySecret, "dysmsapi.aliyuncs.com", array_merge($params, array("RegionId" => "cn-hangzhou", "Action" => "SendSms", "Version" => "2017-05-25")));
+    } else {
+        $data["fa_style"] = "派单中";
+        $res = pdo_insert("hyb_o2o_fadan", $data);
+        $fa_id = pdo_insertid();
+        //通知商家、技师接单
+        $region = $_REQUEST['dizhi'];
+        //查询匹配商家
+        $shangjia = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " where uniacid=:uniacid and s_address like '%{$region}%' ", array(":uniacid" => $uniacid));
+        //查询匹配技师
+        $jishi = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_yuangong") . " where uniacid=:uniacid and y_rz=1", array(":uniacid" => $uniacid));
+        foreach ($jishi as &$valuess) {
+            $valuess['y_jineng'] = unserialize($valuess['y_jineng']);
+        }
+        foreach ($jishi as $key => $valuesss) {
+            if (!in_array($pd['fa_fwstyle2'], $jishi[$key]['y_jineng'])) {
+                unset($jishi[$key]);
+            }
+        }
+        $params = array();
+        $params["SignName"] = $aliduanxin['SignName'];
+        $params["TemplateCode"] = $aliduanxin['fdtz'];
+        foreach ($shangjia as &$value) {
+            $params["PhoneNumbers"] = $value['s_telphone'];
+            //接收人手机号
+            $params['TemplateParam'] = array('name' => $value['s_name'], "product" => "sms");
+            if (!empty($params["TemplateParam"]) && is_array($params["TemplateParam"])) {
+                $params["TemplateParam"] = json_encode($params["TemplateParam"]);
+            }
+            $helper = new SignatureHelper();
+            $content = $helper->request($accessKeyId, $accessKeySecret, "dysmsapi.aliyuncs.com", array_merge($params, array("RegionId" => "cn-hangzhou", "Action" => "SendSms", "Version" => "2017-05-25")));
+        }
+    }
+    die;
+}
+// error_reporting(E_ALL);
+if ($op == "quxiao") {
+    //发单取消 Fadanquxiao
+    $fa_id = $_REQUEST['fa_id'];
+    $info = pdo_fetch("SELECT * FROM " . tablename('hyb_o2o_fadan') . " where uniacid=:uniacid and fa_id=:fa_id", array(":uniacid" => $uniacid, ":fa_id" => $fa_id));
+    $user = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $info['u_id']));
+    if ($info['fa_fwpay_type'] == "一口价") {
+        $u_money = $user['u_money'] + $info['fa_fwmoney'];
+    }
+    if ($info['fa_fwpay_type'] == "定金") {
+        $u_money = $user['u_money'] + $info['fa_fwdingjin'];
+    }
+    if ($info['fa_fwpay_type'] == "上门估价") {
+        $u_money = $user['u_money'] + $info['fa_fwshagneng'];
+    }
+    pdo_update("hyb_o2o_userinfo", array("u_money" => $u_money), array("u_id" => $user['u_id']));
+    pdo_delete("hyb_o2o_fadan", array("fa_id" => $fa_id));
+    output_data("取消成功");
+}
+if ($op == "queren") {
+    //确认服务  Qiangdanfwuser
+    /*        $id = $_REQUEST['id'];
+            //查询抢单
+            $qiangdan = pdo_fetch("SELECT * FROM ".tablename("hyb_o2o_qiangdan")." where uniacid=:uniacid and q_dname=:q_dname",array(":uniacid"=>$uniacid,":q_dname"=>$id));
+            $data = array("q_styles"=>"服务中");
+            $res = pdo_update("hyb_o2o_qiangdan",$data,array("q_id"=>$qiangdan['q_id']));
+            
+            if ($qiangdan['q_types']=="商家" || $qiangdan['q_types']=="门店") {
+                //查询商家
+                $sj = pdo_fetch("SELECT * FROM ".tablename("hyb_o2o_shangjia")." where uniacid=:uniacid and s_u_openid=:s_u_openid",array(":uniacid"=>$uniacid,":s_u_openid"=>$qiangdan['q_openid']));
+                //查询服务员工
+                $yuangong = pdo_fetch("SELECT * FROM ".tablename("hyb_o2o_yuangong")." where uniacid=:uniacid and y_id=:y_id",array(":uniacid"=>$uniacid,":y_id"=>$qiangdan['q_pdname']));
+    
+                require_once dirname(__FILE__) .'/../../inc/func/SignatureHelper.php';
+                $params = array ();
+                $aliduanxin = pdo_fetch("SELECT * FROM ".tablename("hyb_o2o_news")." WHERE uniacid=:uniacid ",array("uniacid"=>$uniacid)); 
+                $accessKeyId = $aliduanxin['accessKeyId'];
+                $accessKeySecret = $aliduanxin['accessKeySecret'];
+                $params["PhoneNumbers"] = $sj['s_telphone'];         //接收人手机号
+                $params["SignName"] = $aliduanxin['SignName'];
+                $params["TemplateCode"] = $aliduanxin['fdtzfwk'];
+                $params['TemplateParam'] = Array (
+                    'name'=>$qiangdan['fa_fwname'],
+                    'content'=>$yuangong['y_name'],
+                    "product"=>"sms"
+                );
+                
+                if(!empty($params["TemplateParam"]) && is_array($params["TemplateParam"])) {
+                    $params["TemplateParam"] = json_encode($params["TemplateParam"]);
+                }
+                $helper = new SignatureHelper();
+                $content = $helper->request(
+                    $accessKeyId,
+                    $accessKeySecret,
+                    "dysmsapi.aliyuncs.com",
+                    array_merge($params, array(
+                        "RegionId" => "cn-hangzhou",
+                        "Action" => "SendSms",
+                        "Version" => "2017-05-25",
+                    ))
+                );
+            }*/
+    output_data("开始服务");
+}
+//发单完成Userfadanwc
+if ($op == "queren") {
+    $fa_id = $_REQUEST['fa_id'];
+    $fadan = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fadan") . " WHERE uniacid=:uniacid and fa_id=:fa_id", array(":uniacid" => $uniacid, ":fa_id" => $fa_id));
+    //查询抢单信息
+    $qiang = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_qiangdan") . " WHERE uniacid=:uniacid and q_dname=:q_dname", array(":uniacid" => $uniacid, ":q_dname" => $fa_id));
+    if ($qiang['q_types'] == "员工") {
+        //查询员工信息
+        $yuangong = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_yuangong") . " WHERE uniacid=:uniacid and y_openid=:y_openid", array(":uniacid" => $uniacid, ":y_openid" => $qiang['q_openid']));
+    } else {
+        //查询员工信息
+        $yuangong = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_yuangong") . " WHERE uniacid=:uniacid and y_id=:y_id", array(":uniacid" => $uniacid, ":y_id" => $qiang['q_pdname']));
+    }
+    //查询平台商家
+    $pingtai = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " WHERE uniacid=:uniacid and pingtai=1", array(":uniacid" => $uniacid));
+    if ($fadan['fa_fwpay_type'] == "上门估价") {
+        pdo_update("hyb_o2o_qiangdan", array("q_styles" => "已完成"), array("q_id" => $qiang['q_id']));
+        if ($fadan['fa_fwmoney'] == '0' && $qiang['q_types'] == "员工") {
+            if (!empty($yuangong['y_choucheng'])) {
+                $money = $fadan['fa_fwshagneng'] * $yuangong['y_choucheng'];
+                //平台抽成
+                $s_money = $pingtai['s_money'] + $money;
+                pdo_update("hyb_o2o_shangjia", array("s_money" => $s_money), array("s_id" => $pingtai['s_id']));
+                $y_money = $yuangong['y_money'] + $fadan['fa_fwshagneng'] - $money;
+                pdo_update("hyb_o2o_yuangong", array("y_typs" => "空闲中", "y_money" => $y_money), array("y_id" => $yuangong['y_id']));
+                $symxy['uniacid'] = $uniacid;
+                $symxy['openid'] = $yuangong['y_openid'];
+                $symxy['fadanid'] = $fadan['fa_id'];
+                $symxy['fadanmoney'] = $fadan['fa_fwmoney'];
+                $symxy['money'] = $fadan['fa_fwshagneng'] - $money;
+                $symxy['time'] = date("Y-m-d H:i:s", time());
+                $symxy['type'] = "员工";
+                $symxy['y_choucheng'] = "0";
+                $symxy['p_choucheng'] = "0";
+                $symxy['status'] = "发单上门费用";
+                $symxy['leixing'] = "1";
+                pdo_insert("hyb_o2o_symx", $symxy);
+            } else {
+                $y_money = $yuangong['y_money'] + $fadan['fa_fwshagneng'];
+                pdo_update("hyb_o2o_yuangong", array("y_typs" => "空闲中", "y_money" => $y_money), array("y_id" => $yuangong['y_id']));
+                $symxy['uniacid'] = $uniacid;
+                $symxy['openid'] = $yuangong['y_openid'];
+                $symxy['fadanid'] = $fadan['fa_id'];
+                $symxy['fadanmoney'] = $fadan['fa_fwmoney'];
+                $symxy['money'] = $fadan['fa_fwshagneng'];
+                $symxy['time'] = date("Y-m-d H:i:s", time());
+                $symxy['type'] = "员工";
+                $symxy['y_choucheng'] = "0";
+                $symxy['p_choucheng'] = "0";
+                $symxy['status'] = "发单上门费用";
+                $symxy['leixing'] = "1";
+                pdo_insert("hyb_o2o_symx", $symxy);
+            }
+        }
+        if ($fadan['fa_fwmoney'] == '0' && $qiang['q_types'] != "员工") {
+            pdo_update("hyb_o2o_yuangong", array("y_typs" => "空闲中"), array("y_id" => $yuangong['y_id']));
+            if ($qiang['q_types'] == '商家') {
+                //查询商家
+                $sj = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " where uniacid=:uniacid and s_u_openid=:s_u_openid", array(":uniacid" => $uniacid, ":s_u_openid" => $qiang['q_openid']));
+                $s_money = $sj['s_money'] + $fadan['fa_fwshagneng'];
+                pdo_update("hyb_o2o_shangjia", array("s_money" => $s_money), array("s_id" => $sj['s_id']));
+            }
+            if ($qiang['q_types'] == "门店") {
+                $s_money = $pingtai['s_money'] + $fadan['fa_fwshagneng'];
+                pdo_update("hyb_o2o_shangjia", array("s_money" => $s_money), array("s_id" => $pingtai['s_id']));
+            }
+        }
+        if ($fadan['fa_fwmoney'] != '0' && $qiang['q_types'] == "员工") {
+            $money = $fadan['fa_fwmoney'] * $yuangong['y_choucheng'];
+            //平台抽成
+            $s_money = $pingtai['s_money'] + $money;
+            pdo_update("hyb_o2o_shangjia", array("s_money" => $s_money), array("s_id" => $pingtai['s_id']));
+            $y_money = $yuangong['y_money'] + $fadan['fa_fwmoney'] - $money;
+            pdo_update("hyb_o2o_yuangong", array("y_typs" => "空闲中", "y_money" => $y_money), array("y_id" => $yuangong['y_id']));
+            pdo_update("hyb_o2o_fadan", array("fa_style" => "已完成"), array("fa_id" => $qiang['q_dname']));
+        }
+        if ($fadan['fa_fwmoney'] != '0' && $qiang['q_types'] != "员工") {
+            $money = $fadan['fa_fwmoney'] * $yuangong['y_choucheng'];
+            //员工分成
+            if ($qiang['q_types'] == '商家') {
+                //查询商家
+                $sj = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " where uniacid=:uniacid and s_u_openid=:s_u_openid", array(":uniacid" => $uniacid, ":s_u_openid" => $qiang['q_openid']));
+                $s_money = $sj['s_money'] + $fadan['fa_fwmoney'] - $money;
+                pdo_update("hyb_o2o_shangjia", array("s_money" => $s_money), array("s_id" => $sj['s_id']));
+                $y_money = $yuangong['y_money'] + $money;
+                pdo_update("hyb_o2o_yuangong", array("y_typs" => "空闲中", "y_money" => $y_money), array("y_id" => $yuangong['y_id']));
+            }
+            if ($qiang['q_types'] == "门店") {
+                $s_money = $pingtai['s_money'] + $money;
+                pdo_update("hyb_o2o_shangjia", array("s_money" => $s_money), array("s_id" => $pingtai['s_id']));
+                $y_money = $yuangong['y_money'] + $fadan['fa_fwmoney'] - $money;
+                pdo_update("hyb_o2o_yuangong", array("y_typs" => "空闲中", "y_money" => $y_money), array("y_id" => $yuangong['y_id']));
+            }
+            pdo_update("hyb_o2o_fadan", array("fa_style" => "已完成"), array("fa_id" => $qiang['q_dname']));
+        }
+    }
+    if ($fadan['fa_fwpay_type'] == "一口价") {
+        pdo_update("hyb_o2o_fadan", array("fa_style" => "已完成"), array("fa_id" => $fa_id));
+        pdo_update("hyb_o2o_qiangdan", array("q_styles" => "已完成"), array("q_id" => $qiang['q_id']));
+        if ($qiang['q_types'] == "员工") {
+            //技师抢单
+            if (!empty($yuangong['y_choucheng'])) {
+                $money = $fadan['fa_fwmoney'] * $yuangong['y_choucheng'];
+                //平台抽成
+                $s_money = $pingtai['s_money'] + $money;
+                pdo_update("hyb_o2o_shangjia", array("s_money" => $s_money), array("s_id" => $pingtai['s_id']));
+                $y_money = $yuangong['y_money'] + $fadan['fa_fwmoney'] - $money;
+                pdo_update("hyb_o2o_yuangong", array("y_typs" => "空闲中", "y_money" => $y_money), array("y_id" => $yuangong['y_id']));
+                $symxy['uniacid'] = $uniacid;
+                $symxy['openid'] = $yuangong['y_openid'];
+                $symxy['fadanid'] = $fadan['fa_id'];
+                $symxy['fadanmoney'] = $fadan['fa_fwmoney'];
+                $symxy['money'] = $fadan['fa_fwmoney'] - $money;
+                $symxy['time'] = date("Y-m-d H:i:s", time());
+                $symxy['type'] = "员工";
+                $symxy['y_choucheng'] = "0";
+                $symxy['p_choucheng'] = $money;
+                $symxy['status'] = "发单服务金额不含上门费用";
+                $symxy['leixing'] = "1";
+                pdo_insert("hyb_o2o_symx", $symxy);
+            } else {
+                $y_money = $yuangong['y_money'] + $fadan['fa_fwmoney'];
+                pdo_update("hyb_o2o_yuangong", array("y_typs" => "空闲中", "y_money" => $y_money), array("y_id" => $yuangong['y_id']));
+                $symxy['uniacid'] = $uniacid;
+                $symxy['openid'] = $yuangong['y_openid'];
+                $symxy['fadanid'] = $fadan['fa_id'];
+                $symxy['fadanmoney'] = $fadan['fa_fwmoney'];
+                $symxy['money'] = $fadan['fa_fwmoney'];
+                $symxy['time'] = date("Y-m-d H:i:s", time());
+                $symxy['type'] = "员工";
+                $symxy['y_choucheng'] = "0";
+                $symxy['p_choucheng'] = "0";
+                $symxy['status'] = "发单服务金额不含上门费用";
+                $symxy['leixing'] = "1";
+                pdo_insert("hyb_o2o_symx", $symxy);
+            }
+        }
+        if ($qiang['q_types'] != "员工") {
+            if ($qiang['q_types'] == '商家') {
+                //查询商家
+                $sj = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " where uniacid=:uniacid and s_u_openid=:s_u_openid", array(":uniacid" => $uniacid, ":s_u_openid" => $qiang['q_openid']));
+                $choushui = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " WHERE uniacid=:uniacid and xt_name=:xt_name", array(":uniacid" => $uniacid, ":xt_name" => $sj['s_type']));
+                if (empty($choushui)) {
+                    $choucheng = "0";
+                } else {
+                    $choucheng = $choushui['choushui'];
+                }
+                if (empty($yuangong['y_choucheng'])) {
+                    $y_choucheng = "0";
+                } else {
+                    $y_choucheng = $yuangong['y_choucheng'];
+                }
+                if (!empty($qiang['q_pdname'])) {
+                    $c_money = $fadan['fa_fwmoney'] * $choucheng;
+                    $ygc_money = ($fadan['fa_fwmoney'] - $c_money) * $y_choucheng;
+                    $s_money = $sj['s_money'] + $fadan['fa_fwmoney'] - $c_money - $ygc_money;
+                    pdo_update("hyb_o2o_shangjia", array("s_money" => $s_money), array("s_id" => $sj['s_id']));
+                    $y_money = $yuangong['y_money'] + $ygc_money;
+                    pdo_update("hyb_o2o_yuangong", array("y_typs" => "空闲中", "y_money" => $y_money), array("y_id" => $yuangong['y_id']));
+                    $symxy['uniacid'] = $uniacid;
+                    $symxy['openid'] = $yuangong['y_openid'];
+                    $symxy['fadanid'] = $fadan['fa_id'];
+                    $symxy['fadanmoney'] = $fadan['fa_fwmoney'];
+                    $symxy['money'] = $ygc_money;
+                    $symxy['time'] = date("Y-m-d H:i:s", time());
+                    $symxy['type'] = "员工";
+                    $symxy['y_choucheng'] = "0";
+                    $symxy['p_choucheng'] = "0";
+                    $symxy['status'] = "发单服务金额不含上门费用";
+                    $symxy['leixing'] = "1";
+                    pdo_insert("hyb_o2o_symx", $symxy);
+                    $symxs['uniacid'] = $uniacid;
+                    $symxs['openid'] = $sj['s_u_openid'];
+                    $symxs['fadanid'] = $fadan['fa_id'];
+                    $symxs['fadanmoney'] = $fadan['fa_fwmoney'];
+                    $symxs['money'] = $fadan['fa_fwmoney'] - $c_money;
+                    $symxs['time'] = date("Y-m-d H:i:s", time());
+                    $symxs['type'] = "商家";
+                    $symxs['y_choucheng'] = $ygc_money;
+                    $symxs['p_choucheng'] = $c_money;
+                    $symxs['status'] = "发单服务金额不含上门费用";
+                    $symxs['leixing'] = "1";
+                    pdo_insert("hyb_o2o_symx", $symxs);
+                } else {
+                    $c_money = $fadan['fa_fwmoney'] * $choucheng;
+                    $s_money = $sj['s_money'] + $fadan['fa_fwmoney'] - $c_money;
+                    pdo_update("hyb_o2o_shangjia", array("s_money" => $s_money), array("s_id" => $sj['s_id']));
+                    $symxs['uniacid'] = $uniacid;
+                    $symxs['openid'] = $sj['s_u_openid'];
+                    $symxs['fadanid'] = $fadan['fa_id'];
+                    $symxs['fadanmoney'] = $fadan['fa_fwmoney'];
+                    $symxs['money'] = $fadan['fa_fwmoney'] - $c_money;
+                    $symxs['time'] = date("Y-m-d H:i:s", time());
+                    $symxs['type'] = "商家";
+                    $symxs['y_choucheng'] = "0";
+                    $symxs['p_choucheng'] = $c_money;
+                    $symxs['status'] = "发单服务金额不含上门费用";
+                    $symxs['leixing'] = "1";
+                    pdo_insert("hyb_o2o_symx", $symxs);
+                }
+            }
+            if ($qiang['q_types'] == "门店") {
+                if (!empty($yuangong['y_choucheng'])) {
+                    $money = $fadan['fa_fwmoney'] * $yuangong['y_choucheng'];
+                    $symxy['uniacid'] = $uniacid;
+                    $symxy['openid'] = $yuangong['y_openid'];
+                    $symxy['fadanid'] = $fadan['fa_id'];
+                    $symxy['fadanmoney'] = $fadan['fa_fwmoney'];
+                    $symxy['money'] = $fadan['fa_fwmoney'] - $money;
+                    $symxy['time'] = date("Y-m-d H:i:s", time());
+                    $symxy['type'] = "员工";
+                    $symxy['y_choucheng'] = "0";
+                    $symxy['p_choucheng'] = $money;
+                    $symxy['status'] = "发单服务金额不含上门费用";
+                    $symxy['leixing'] = "1";
+                    pdo_insert("hyb_o2o_symx", $symxy);
+                    $s_money = $pingtai['s_money'] + $money;
+                    pdo_update("hyb_o2o_shangjia", array("s_money" => $s_money), array("s_id" => $pingtai['s_id']));
+                    $y_money = $yuangong['y_money'] + $fadan['fa_fwmoney'] - $money;
+                    pdo_update("hyb_o2o_yuangong", array("y_typs" => "空闲中", "y_money" => $y_money), array("y_id" => $yuangong['y_id']));
+                } else {
+                    $symxy['uniacid'] = $uniacid;
+                    $symxy['openid'] = $yuangong['y_openid'];
+                    $symxy['fadanid'] = $fadan['fa_id'];
+                    $symxy['fadanmoney'] = $fadan['fa_fwmoney'];
+                    $symxy['money'] = $fadan['fa_fwmoney'];
+                    $symxy['time'] = date("Y-m-d H:i:s", time());
+                    $symxy['type'] = "员工";
+                    $symxy['y_choucheng'] = "0";
+                    $symxy['p_choucheng'] = "0";
+                    $symxy['status'] = "发单服务金额不含上门费用";
+                    $symxy['leixing'] = "1";
+                    pdo_insert("hyb_o2o_symx", $symxy);
+                    $y_money = $yuangong['y_money'] + $fadan['fa_fwmoney'];
+                    pdo_update("hyb_o2o_yuangong", array("y_typs" => "空闲中", "y_money" => $y_money), array("y_id" => $yuangong['y_id']));
+                }
+            }
+        }
+    }
+}
+if ($op == 'get') {
+    $latitude = '38.054662894458';
+    $longitude = '114.48129456957';
+    $url = "https://api.map.baidu.com/geocoder/v2/?callback=renderReverse&location=37.658651,112.745415&output=json&pois=1&latest_admin=1&ak=aYFtPT3RPtkiIsXfxX7BnDr587eLSnyl";
+    $curl = curl_init();
+    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Host: www.zhihu.com", "Connection: keep-alive", "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Upgrade-Insecure-Requests: 1", "DNT:1", "Accept-Language: zh-CN,zh;q=0.8,en-GB;q=0.6,en;q=0.4,en-US;q=0.2", 'Cookie:_za=4540d427-eee1-435a-a533-66ecd8676d7d; __utma=51854390.3169871.1440319332.1441339521.1442067491.5; __utmz=51854390.1442067491.5.5.utmcsr=baidu|utmccn=(organic)|utmcmd=organic; __utmv=51854390.100-1|2=registration_date=20140525=1^3=entry_date=20140525=1; q_c1=efa8c4ccdba04f63a0ba88845f485836|1451394239000|1440047640000; _xsrf=20c250b28098f92459cac05a3944d48d; cap_id="ZWQ5OGIzN2JiZWNmNGRlNGE3YTE1MTE0YTA5YjY1NjE=|1451394239|0efd13fc965c43c0fb6a7a2523b5dac4d1dac7e3"; z_c0="QUFCQXRLa3ZBQUFYQUFBQVlRSlZUY29ScWxZN0k3T1BHaFdqb1JNVlVZekNnZ0trU0xXdEdnPT0=|1451394250|02ed77acc81edbf2340fd0ce1b13618862b3674e"; unlock_ticket="QUFCQXRLa3ZBQUFYQUFBQVlRSlZUZEtMZ2xiM21FNDRmdzdsX1NnOVdieUp3M1VtY0RsaUVBPT0=|1451394250|8cf44cefb523b2973eca01f0918ef97fc03a49qa"'));
+    curl_setopt($curl, CURLOPT_URL, $url);
+    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
+    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
+    if (!empty($data)) {
+        curl_setopt($curl, CURLOPT_POST, 1);
+        curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
+    }
+    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0');
+    // curl_setopt($ch, CURLOPT_REFERER, "https://www.webstrongtech.net");
+    $output = curl_exec($curl);
+    curl_close($curl);
+    $result = $output;
+    $resultArry = json_decode($result, true);
+    var_dump($resultArry);
+    var_dump($resultArry['result']['formatted_address']);
+    die;
+}
+include $this->template('fabu_main/fabu_main');

+ 101 - 0
server/addons/hyb_o2o/inc/mobile/find.inc.php

xqd
@@ -0,0 +1,101 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+// error_reporting(E_ALL);
+if ($op == 'display') {
+    $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " WHERE uniacid=:uniacid and xt_parentid=0 order by xt_ids desc ", array(":uniacid" => $uniacid));
+    if (!empty($list)) {
+        foreach ($list as &$value) {
+            $xiangmu = pdo_fetchall("SELECT x_id FROM " . tablename("hyb_o2o_fuwu") . " WHERE uniacid=:uniacid and x_parenttype=:x_parenttype", array(":uniacid" => $uniacid, ":x_parenttype" => $value['xt_id']));
+            if (!empty($xiangmu)) {
+                foreach ($xiangmu as &$value1) {
+                    $xid[] = $value1['x_id'];
+                }
+                $xids = implode(",", $xid);
+                $info = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwupingjia") . " WHERE uniacid=:uniacid and p_sid in({$xids})", array(":uniacid" => $uniacid));
+                if (!empty($info)) {
+                    foreach ($info as &$value2) {
+                        $value2['p_name'] = json_decode($value2['p_name']);
+                        $value2['p_pic'] = unserialize($value2['p_pic']);
+                    }
+                }
+                $value['info'] = $info;
+            } else {
+                $value['info'] = [];
+            }
+        }
+    }
+}
+if ($op == 'list') {
+    // Faxianinfo
+    $xt_id = $_REQUEST['xt_id'];
+    if (empty($xt_id)) {
+        $type = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " WHERE uniacid=:uniacid and xt_parentid=0 order by xt_ids desc", array(":uniacid" => $uniacid));
+        $typeid = $type[0]['xt_id'];
+        $xiangmu = pdo_fetchall("SELECT x_id FROM " . tablename("hyb_o2o_fuwu") . " WHERE uniacid=:uniacid and x_parenttype=:x_parenttype", array(":uniacid" => $uniacid, ":x_parenttype" => $typeid));
+        if (!empty($xiangmu)) {
+            foreach ($xiangmu as &$value1) {
+                $xid[] = $value1['x_id'];
+            }
+            $xids = implode(",", $xid);
+            $info = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwupingjia") . " WHERE uniacid=:uniacid and p_sid in({$xids}) order by p_time desc ", array(":uniacid" => $uniacid));
+            if (!empty($info)) {
+                foreach ($info as &$value2) {
+                    $value2['p_name'] = json_decode($value2['p_name']);
+                    $value2['p_pic'] = unserialize($value2['p_pic']);
+                    //查询项目
+                    $fuwu = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " WHERE uniacid=:uniacid and x_id=:x_id", array(":uniacid" => $uniacid, ":x_id" => $value2['p_sid']));
+                    if (!empty($fuwu)) {
+                        $value2['x_thumb'] = $_W['attachurl'] . $fuwu['x_thumb'];
+                        $value2['x_name'] = $fuwu['x_name'];
+                        $value2['x_xiaoliang'] = $fuwu['x_xiaoliang'];
+                        $fuwupf = pdo_fetchall("SELECT count(*) as pingfennum,sum(p_fenshu) as pingfen  FROM " . tablename("hyb_o2o_fuwupingjia") . " where uniacid=:uniacid and p_sid=:p_sid", array(":uniacid" => $uniacid, ":p_sid" => $value2['p_sid']));
+                        $pingfen = $fuwupf[0]['pingfen'] / $fuwupf[0]['pingfennum'];
+                        if (empty($pingfen) || $pingfen == '0') {
+                            $value2['haopinglv'] = 100;
+                        } else {
+                            $value2['haopinglv'] = ceil($pingfen) * 20;
+                        }
+                    }
+                }
+            }
+        } else {
+            $info = [];
+        }
+    } else {
+        $xiangmu = pdo_fetchall("SELECT x_id FROM " . tablename("hyb_o2o_fuwu") . " WHERE uniacid=:uniacid and x_parenttype=:x_parenttype", array(":uniacid" => $uniacid, ":x_parenttype" => $xt_id));
+        if (!empty($xiangmu)) {
+            foreach ($xiangmu as &$value1) {
+                $xid[] = $value1['x_id'];
+            }
+            $xids = implode(",", $xid);
+            $info = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwupingjia") . " WHERE uniacid=:uniacid and p_sid in({$xids}) order by p_time desc ", array(":uniacid" => $uniacid));
+            if (!empty($info)) {
+                foreach ($info as &$value2) {
+                    $value2['p_name'] = json_decode($value2['p_name']);
+                    $value2['p_pic'] = unserialize($value2['p_pic']);
+                    //查询项目
+                    $fuwu = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " WHERE uniacid=:uniacid and x_id=:x_id", array(":uniacid" => $uniacid, ":x_id" => $value2['p_sid']));
+                    if (!empty($fuwu)) {
+                        $value2['x_thumb'] = $_W['attachurl'] . $fuwu['x_thumb'];
+                        $value2['x_name'] = $fuwu['x_name'];
+                        $value2['x_xiaoliang'] = $fuwu['x_xiaoliang'];
+                        $fuwupf = pdo_fetchall("SELECT count(*) as pingfennum,sum(p_fenshu) as pingfen  FROM " . tablename("hyb_o2o_fuwupingjia") . " where uniacid=:uniacid and p_sid=:p_sid", array(":uniacid" => $uniacid, ":p_sid" => $value2['p_sid']));
+                        $pingfen = $fuwupf[0]['pingfen'] / $fuwupf[0]['pingfennum'];
+                        if (empty($pingfen) || $pingfen == '0') {
+                            $value2['haopinglv'] = 100;
+                        } else {
+                            $value2['haopinglv'] = ceil($pingfen) * 20;
+                        }
+                    }
+                }
+            }
+        } else {
+            $info = [];
+        }
+    }
+    output_data($info);
+}
+include $this->template('find/find');

+ 10 - 0
server/addons/hyb_o2o/inc/mobile/first_yuyue.inc.php

xqd
@@ -0,0 +1,10 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+if ($op == 'display') {
+}
+if ($op == 'reg') {
+}
+include $this->template('first_yuyue/first_yuyue');

+ 483 - 0
server/addons/hyb_o2o/inc/mobile/fuwu_list.inc.php

xqd
@@ -0,0 +1,483 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+// error_reporting(E_ALL);
+if ($op == 'display') {
+    $list_fenlei = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_goods_style") . " where uniacid=:uniacid", array(":uniacid" => $uniacid));
+    $city = $_COOKIE['city'];
+    if ($city == '全国') {
+        $diqu_info = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_city") . " where uniacid=:uniacid and  parentid=0", array(":uniacid" => $uniacid));
+    } else {
+        $city_info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_city") . " where uniacid=:uniacid and name=:name and parentid=0", array(":uniacid" => $uniacid, ":name" => $city));
+        $diqu_info = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_city") . " where uniacid=:uniacid and parentid=:parentid", array(":uniacid" => $uniacid, ":parentid" => $city_info['id']));
+    }
+    // var_dump($info);
+}
+if ($op == 'fuwu_list') {
+    $xt_id = $_REQUEST['xt_id'];
+    //项目分类id
+    $diqu = $_REQUEST['diqu'];
+    //地区
+    $flname = $_REQUEST['flname'];
+    //分类
+    $city = $_REQUEST["city"];
+    //城市
+    $shaixuan = $_REQUEST['shaixuan'];
+    //筛选
+    $openid = $_REQUEST['openid'];
+    $xiangmutype = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_id=:xt_id", array(":uniacid" => $uniacid, "xt_id" => $xt_id));
+    $parentid = $xiangmutype['xt_parentid'];
+    $time = date("Y-m-d H:i:s", time());
+    if ($parentid == "0") {
+        if (empty($diqu) && empty($flname) && empty($shaixuan)) {
+            //无筛选条件
+            //查询项目分类
+            $xiangmutype = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_id=:xt_id", array(":uniacid" => $uniacid, "xt_id" => $xt_id));
+            //查询商家
+            $shangjia = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " WHERE uniacid=:uniacid and s_type in('全部','" . $xiangmutype['xt_name'] . "') and s_address like '%{$city}%' and s_status=:s_status and ruzhu_endtime!=:ruzhu_endtime and ruzhu_endtime>'" . $time . "'", array(":uniacid" => $uniacid, ":s_status" => "审核通过", ":ruzhu_endtime" => "已到期"));
+            if (!empty($shangjia)) {
+                foreach ($shangjia as &$value) {
+                    $s_id[] = $value['s_id'];
+                }
+                $s_id = implode(",", $s_id);
+                //查询项目分类下二级分类
+                $erji = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_parentid=:xt_parentid", array(":uniacid" => $uniacid, ":xt_parentid" => $xiangmutype['xt_id']));
+                foreach ($erji as &$value1) {
+                    $erji_id[] = $value1['xt_id'];
+                }
+                $erji_id = implode(",", $erji_id);
+                //查询项目
+                $xiangmu = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " where uniacid=:uniacid and x_type in ({$erji_id}) and x_shangjia in ({$s_id}) and x_status=1", array(":uniacid" => $uniacid));
+                if (empty($xiangmu)) {
+                    $xiangmu = [];
+                }
+            } else {
+                $xiangmu = [];
+            }
+        }
+        if (!empty($diqu) && empty($flname) && empty($shaixuan)) {
+            //筛选条件  地区
+            $city = $city . "-" . $diqu;
+            //查询项目分类
+            $xiangmutype = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_id=:xt_id", array(":uniacid" => $uniacid, "xt_id" => $xt_id));
+            //查询商家
+            $shangjia = pdo_fetchall("SELECT s_id FROM " . tablename("hyb_o2o_shangjia") . " WHERE uniacid=:uniacid and s_type in('全部','" . $xiangmutype['xt_name'] . "') and s_address like '%{$city}%' and s_status=:s_status and ruzhu_endtime!=:ruzhu_endtime and ruzhu_endtime>'" . $time . "'  ", array(":uniacid" => $uniacid, ":s_status" => "审核通过", ":ruzhu_endtime" => "已到期"));
+            if (!empty($shangjia)) {
+                foreach ($shangjia as &$value) {
+                    $s_id[] = $value['s_id'];
+                }
+                $s_id = implode(",", $s_id);
+                //查询项目分类下二级分类
+                $erji = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_parentid=:xt_parentid", array(":uniacid" => $uniacid, ":xt_parentid" => $xiangmutype['xt_id']));
+                foreach ($erji as &$value1) {
+                    $erji_id[] = $value1['xt_id'];
+                }
+                $erji_id = implode(",", $erji_id);
+                //查询项目
+                $xiangmu = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " where uniacid=:uniacid and x_type in ({$erji_id}) and x_shangjia in ({$s_id}) and x_status=1", array(":uniacid" => $uniacid));
+                if (empty($xiangmu)) {
+                    $xiangmu = [];
+                }
+            } else {
+                $xiangmu = [];
+            }
+        }
+        if (empty($diqu) && !empty($flname) && empty($shaixuan)) {
+            //筛选条件  分类
+            //查询项目分类
+            $xiangmutype = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_id=:xt_id", array(":uniacid" => $uniacid, "xt_id" => $xt_id));
+            //查询商家
+            $shangjia = pdo_fetchall("SELECT s_id FROM " . tablename("hyb_o2o_shangjia") . " WHERE uniacid=:uniacid and s_type in('全部','" . $xiangmutype['xt_name'] . "') and s_address like '%{$city}%' and s_status=:s_status and ruzhu_endtime!=:ruzhu_endtime and ruzhu_endtime>'" . $time . "' ", array(":uniacid" => $uniacid, ":s_status" => "审核通过", ":ruzhu_endtime" => "已到期"));
+            if (!empty($shangjia)) {
+                foreach ($shangjia as &$value) {
+                    $s_id[] = $value['s_id'];
+                }
+                $s_id = implode(",", $s_id);
+                $xiangmutypes = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_name=:xt_name and xt_parentid=:xt_parentid", array(":uniacid" => $uniacid, "xt_name" => $flname, ":xt_parentid" => $xiangmutype['xt_id']));
+                //查询项目
+                $xiangmu = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " where uniacid=:uniacid and x_type=:x_type and x_shangjia in ({$s_id})  and x_status=1", array(":uniacid" => $uniacid, ":x_type" => $xiangmutypes['xt_id']));
+                if (empty($xiangmu)) {
+                    $xiangmu = [];
+                }
+            } else {
+                $xiangmu = [];
+            }
+        }
+        if (empty($diqu) && empty($flname) && !empty($shaixuan)) {
+            //筛选条件  筛选
+            //查询项目分类
+            $xiangmutype = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_id=:xt_id", array(":uniacid" => $uniacid, "xt_id" => $xt_id));
+            //查询商家
+            $shangjia = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " WHERE uniacid=:uniacid and s_type in('全部','" . $xiangmutype['xt_name'] . "') and s_address like '%{$city}%' and s_status=:s_status and ruzhu_endtime!=:ruzhu_endtime and ruzhu_endtime>'" . $time . "'", array(":uniacid" => $uniacid, ":s_status" => "审核通过", ":ruzhu_endtime" => "已到期"));
+            if (!empty($shangjia)) {
+                foreach ($shangjia as &$value) {
+                    $s_id[] = $value['s_id'];
+                }
+                $s_id = implode(",", $s_id);
+                //查询项目分类下二级分类
+                $erji = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_parentid=:xt_parentid", array(":uniacid" => $uniacid, ":xt_parentid" => $xiangmutype['xt_id']));
+                foreach ($erji as &$value1) {
+                    $erji_id[] = $value1['xt_id'];
+                }
+                $erji_id = implode(",", $erji_id);
+                if ($shaixuan == "销量高") {
+                    //查询项目
+                    $xiangmu = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " where uniacid=:uniacid and x_type in ({$erji_id}) and x_shangjia in ({$s_id}) and x_status=1 order by x_xiaoliang desc ", array(":uniacid" => $uniacid));
+                    if (empty($xiangmu)) {
+                        $xiangmu = [];
+                    }
+                }
+                if ($shaixuan == "价格低") {
+                    //查询项目
+                    $xiangmu = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " where uniacid=:uniacid and x_type in ({$erji_id}) and x_shangjia in ({$s_id}) and x_status=1 order by x_jiage asc ", array(":uniacid" => $uniacid));
+                    if (empty($xiangmu)) {
+                        $xiangmu = [];
+                    }
+                }
+            }
+        }
+        if (!empty($diqu) && !empty($flname) && empty($shaixuan)) {
+            //筛选条件   地区 分类
+            $city = $city . "-" . $diqu;
+            //查询项目分类
+            $xiangmutype = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_id=:xt_id", array(":uniacid" => $uniacid, "xt_id" => $xt_id));
+            //查询商家
+            $shangjia = pdo_fetchall("SELECT s_id FROM " . tablename("hyb_o2o_shangjia") . " WHERE uniacid=:uniacid and s_type in('全部','" . $xiangmutype['xt_name'] . "') and s_address like '%{$city}%' and s_status=:s_status and ruzhu_endtime!=:ruzhu_endtime and ruzhu_endtime>'" . $time . "'  ", array(":uniacid" => $uniacid, ":s_status" => "审核通过", ":ruzhu_endtime" => "已到期"));
+            if (!empty($shangjia)) {
+                foreach ($shangjia as &$value) {
+                    $s_id[] = $value['s_id'];
+                }
+                $s_id = implode(",", $s_id);
+                $xiangmutypes = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_name=:xt_name and xt_parentid=:xt_parentid", array(":uniacid" => $uniacid, "xt_name" => $flname, ":xt_parentid" => $xiangmutype['xt_id']));
+                //查询项目
+                $xiangmu = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " where uniacid=:uniacid and x_type=:x_type and x_shangjia in ({$s_id}) and x_status=1", array(":uniacid" => $uniacid, ":x_type" => $xiangmutypes['xt_id']));
+                if (empty($xiangmu)) {
+                    $xiangmu = [];
+                }
+            } else {
+                $xiangmu = [];
+            }
+        }
+        if (!empty($diqu) && empty($flname) && !empty($shaixuan)) {
+            //筛选条件   地区  筛选
+            $city = $city . "-" . $diqu;
+            //查询项目分类
+            $xiangmutype = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_id=:xt_id", array(":uniacid" => $uniacid, "xt_id" => $xt_id));
+            //查询商家
+            $shangjia = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " WHERE uniacid=:uniacid and s_type in('全部','" . $xiangmutype['xt_name'] . "') and s_address like '%{$city}%' and s_status=:s_status and ruzhu_endtime!=:ruzhu_endtime and ruzhu_endtime>'" . $time . "'", array(":uniacid" => $uniacid, ":s_status" => "审核通过", ":ruzhu_endtime" => "已到期"));
+            if (!empty($shangjia)) {
+                foreach ($shangjia as &$value) {
+                    $s_id[] = $value['s_id'];
+                }
+                $s_id = implode(",", $s_id);
+                //查询项目分类下二级分类
+                $erji = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_parentid=:xt_parentid", array(":uniacid" => $uniacid, ":xt_parentid" => $xiangmutype['xt_id']));
+                foreach ($erji as &$value1) {
+                    $erji_id[] = $value1['xt_id'];
+                }
+                $erji_id = implode(",", $erji_id);
+                if ($shaixuan == "销量高") {
+                    //查询项目
+                    $xiangmu = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " where uniacid=:uniacid and x_type in ({$erji_id}) and x_shangjia in ({$s_id}) and x_status=1 order by x_xiaoliang desc ", array(":uniacid" => $uniacid));
+                    if (empty($xiangmu)) {
+                        $xiangmu = [];
+                    }
+                }
+                if ($shaixuan == "价格低") {
+                    //查询项目
+                    $xiangmu = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " where uniacid=:uniacid and x_type in ({$erji_id}) and x_shangjia in ({$s_id}) and x_status=1 order by x_jiage asc ", array(":uniacid" => $uniacid));
+                    if (empty($xiangmu)) {
+                        $xiangmu = [];
+                    }
+                }
+            } else {
+                $xiangmu = [];
+            }
+        }
+        if (empty($diqu) && !empty($flname) && !empty($shaixuan)) {
+            //筛选条件 分类 筛选
+            //查询项目分类
+            $xiangmutype = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_id=:xt_id", array(":uniacid" => $uniacid, "xt_id" => $xt_id));
+            //查询商家
+            $shangjia = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " WHERE uniacid=:uniacid and s_type in('全部','" . $xiangmutype['xt_name'] . "') and s_address like '%{$city}%' and s_status=:s_status and ruzhu_endtime!=:ruzhu_endtime and ruzhu_endtime>'" . $time . "'", array(":uniacid" => $uniacid, ":s_status" => "审核通过", ":ruzhu_endtime" => "已到期"));
+            if (!empty($shangjia)) {
+                foreach ($shangjia as &$value) {
+                    $s_id[] = $value['s_id'];
+                }
+                $s_id = implode(",", $s_id);
+                $xiangmutypes = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_name=:xt_name and xt_parentid=:xt_parentid", array(":uniacid" => $uniacid, "xt_name" => $flname, ":xt_parentid" => $xiangmutype['xt_id']));
+                if ($shaixuan == "销量高") {
+                    //查询项目
+                    $xiangmu = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " where uniacid=:uniacid and x_type=:x_type and x_shangjia in ({$s_id}) and x_status=1 order by x_xiaoliang desc ", array(":uniacid" => $uniacid, ":x_type" => $xiangmutypes['xt_id']));
+                    if (empty($xiangmu)) {
+                        $xiangmu = [];
+                    }
+                }
+                if ($shaixuan == "价格低") {
+                    //查询项目
+                    $xiangmu = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " where uniacid=:uniacid and x_type=:x_type and x_shangjia in ({$s_id}) and x_status=1 order by x_jiage asc ", array(":uniacid" => $uniacid, ":x_type" => $xiangmutypes['xt_id']));
+                    if (empty($xiangmu)) {
+                        $xiangmu = [];
+                    }
+                }
+            } else {
+                $xiangmu = [];
+            }
+        }
+        if (!empty($diqu) && !empty($flname) && !empty($shaixuan)) {
+            //筛选条件 地区 分类 筛选
+            $city = $city . "-" . $diqu;
+            //查询项目分类
+            $xiangmutype = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_id=:xt_id", array(":uniacid" => $uniacid, "xt_id" => $xt_id));
+            //查询商家
+            $shangjia = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " WHERE uniacid=:uniacid and s_type in('全部','" . $xiangmutype['xt_name'] . "') and s_address like '%{$city}%' and s_status=:s_status and ruzhu_endtime!=:ruzhu_endtime and ruzhu_endtime>'" . $time . "'", array(":uniacid" => $uniacid, ":s_status" => "审核通过", ":ruzhu_endtime" => "已到期"));
+            if (!empty($shangjia)) {
+                foreach ($shangjia as &$value) {
+                    $s_id[] = $value['s_id'];
+                }
+                $s_id = implode(",", $s_id);
+                $xiangmutypes = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_name=:xt_name and xt_parentid=:xt_parentid", array(":uniacid" => $uniacid, "xt_name" => $flname, ":xt_parentid" => $xiangmutype['xt_id']));
+                if ($shaixuan == "销量高") {
+                    //查询项目
+                    $xiangmu = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " where uniacid=:uniacid and x_type=:x_type and x_shangjia in ({$s_id}) and x_status=1 order by x_xiaoliang desc ", array(":uniacid" => $uniacid, ":x_type" => $xiangmutypes['xt_id']));
+                    if (empty($xiangmu)) {
+                        $xiangmu = [];
+                    }
+                }
+                if ($shaixuan == "价格低") {
+                    //查询项目
+                    $xiangmu = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " where uniacid=:uniacid and x_type=:x_type and x_shangjia in ({$s_id}) and x_status=1 order by x_jiage asc ", array(":uniacid" => $uniacid, ":x_type" => $xiangmutypes['xt_id']));
+                    if (empty($xiangmu)) {
+                        $xiangmu = [];
+                    }
+                }
+            } else {
+                $xiangmu = [];
+            }
+        }
+    } else {
+        $time = date("Y-m-d H:i:s", time());
+        if (empty($diqu) && empty($shaixuan)) {
+            //无筛选条件
+            //查询项目分类
+            $xiangmutype = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_id=:xt_id", array(":uniacid" => $uniacid, "xt_id" => $parentid));
+            //查询商家
+            $shangjia = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " WHERE uniacid=:uniacid and s_type in('全部','" . $xiangmutype['xt_name'] . "') and s_address like '%{$city}%' and s_status=:s_status and ruzhu_endtime!=:ruzhu_endtime and ruzhu_endtime>'" . $time . "'", array(":uniacid" => $uniacid, ":s_status" => "审核通过", ":ruzhu_endtime" => "已到期"));
+            if (!empty($shangjia)) {
+                foreach ($shangjia as &$value) {
+                    $s_id[] = $value['s_id'];
+                }
+                $s_id = implode(",", $s_id);
+                //查询项目
+                $xiangmu = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " where uniacid=:uniacid and x_type=:x_type and x_shangjia in ({$s_id}) and x_status=1", array(":uniacid" => $uniacid, ":x_type" => $xt_id));
+                if (empty($xiangmu)) {
+                    $xiangmu = [];
+                }
+            } else {
+                $xiangmu = [];
+            }
+        }
+        if (!empty($diqu) && empty($shaixuan)) {
+            //筛选条件  地区
+            $city = $city . "-" . $diqu;
+            //查询项目分类
+            $xiangmutype = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_id=:xt_id", array(":uniacid" => $uniacid, "xt_id" => $parentid));
+            //查询商家
+            $shangjia = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " WHERE uniacid=:uniacid and s_type in('全部','" . $xiangmutype['xt_name'] . "') and s_address like '%{$city}%' and s_status=:s_status and ruzhu_endtime!=:ruzhu_endtime and ruzhu_endtime>'" . $time . "'", array(":uniacid" => $uniacid, ":s_status" => "审核通过", ":ruzhu_endtime" => "已到期"));
+            if (!empty($shangjia)) {
+                foreach ($shangjia as &$value) {
+                    $s_id[] = $value['s_id'];
+                }
+                $s_id = implode(",", $s_id);
+                //查询项目
+                $xiangmu = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " where uniacid=:uniacid and x_type=:x_type and x_shangjia in ({$s_id}) and x_status=1", array(":uniacid" => $uniacid, ":x_type" => $xt_id));
+                if (empty($xiangmu)) {
+                    $xiangmu = [];
+                }
+            } else {
+                $xiangmu = [];
+            }
+        }
+        if (empty($diqu) && !empty($shaixuan)) {
+            //筛选条件  筛选
+            //查询项目分类
+            $xiangmutype = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_id=:xt_id", array(":uniacid" => $uniacid, "xt_id" => $parentid));
+            //查询商家
+            $shangjia = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " WHERE uniacid=:uniacid and s_type in('全部','" . $xiangmutype['xt_name'] . "') and s_address like '%{$city}%' and s_status=:s_status and ruzhu_endtime!=:ruzhu_endtime and ruzhu_endtime>'" . $time . "'", array(":uniacid" => $uniacid, ":s_status" => "审核通过", ":ruzhu_endtime" => "已到期"));
+            if (!empty($shangjia)) {
+                foreach ($shangjia as &$value) {
+                    $s_id[] = $value['s_id'];
+                }
+                $s_id = implode(",", $s_id);
+                if ($shaixuan == "销量高") {
+                    //查询项目
+                    $xiangmu = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " where uniacid=:uniacid and x_type=:x_type and x_shangjia in ({$s_id})  and x_status=1 order by x_xiaoliang desc ", array(":uniacid" => $uniacid, ":x_type" => $xt_id));
+                    if (empty($xiangmu)) {
+                        $xiangmu = [];
+                    }
+                }
+                if ($shaixuan == "价格低") {
+                    //查询项目
+                    $xiangmu = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " where uniacid=:uniacid and x_type=:x_type and x_shangjia in ({$s_id}) and x_status=1 order by x_jiage asc ", array(":uniacid" => $uniacid, ":x_type" => $xt_id));
+                    if (empty($xiangmu)) {
+                        $xiangmu = [];
+                    }
+                }
+            } else {
+                $xiangmu = [];
+            }
+        }
+        if (!empty($diqu) && !empty($shaixuan)) {
+            //筛选条件 地区 筛选
+            $city = $city . "-" . $diqu;
+            //查询项目分类
+            $xiangmutype = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_id=:xt_id", array(":uniacid" => $uniacid, "xt_id" => $parentid));
+            //查询商家
+            $shangjia = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " WHERE uniacid=:uniacid and s_type in('全部','" . $xiangmutype['xt_name'] . "') and s_address like '%{$city}%' and s_status=:s_status and ruzhu_endtime!=:ruzhu_endtime and ruzhu_endtime>'" . $time . "'", array(":uniacid" => $uniacid, ":s_status" => "审核通过", ":ruzhu_endtime" => "已到期"));
+            if (!empty($shangjia)) {
+                foreach ($shangjia as &$value) {
+                    $s_id[] = $value['s_id'];
+                }
+                $s_id = implode(",", $s_id);
+                if ($shaixuan == "销量高") {
+                    //查询项目
+                    $xiangmu = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " where uniacid=:uniacid and x_type=:x_type and x_shangjia in ({$s_id}) and x_status=1 order by x_xiaoliang desc ", array(":uniacid" => $uniacid, ":x_type" => $xt_id));
+                    if (empty($xiangmu)) {
+                        $xiangmu = [];
+                    }
+                }
+                if ($shaixuan == "价格低") {
+                    //查询项目
+                    $xiangmu = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " where uniacid=:uniacid and x_type=:x_type and x_shangjia in ({$s_id}) and x_status=1 order by x_jiage asc ", array(":uniacid" => $uniacid, ":x_type" => $xt_id));
+                    if (empty($xiangmu)) {
+                        $xiangmu = [];
+                    }
+                }
+            } else {
+                $xiangmu = [];
+            }
+        }
+    }
+    if (!empty($xiangmu)) {
+        foreach ($xiangmu as &$value2) {
+            if (strpos($value2['x_thumb'], "http") === false) {
+                $value2['x_thumb'] = $_W['attachurl'] . $value2['x_thumb'];
+            }
+            if (strpos($value2['x_thumb'], "http") === false) {
+                $value2['x_thumb'] = $_W['attachurl'] . $value2['x_thumb'];
+            }
+            if (empty($value2['x_label'])) {
+                $value2['x_label'] = "";
+            }
+            //查询评论数
+            $pingfennum = pdo_fetchcolumn("SELECT count(*)  FROM " . tablename('hyb_o2o_fuwupingjia') . "where uniacid=:uniacid and p_sid=:p_sid", array(":uniacid" => $uniacid, ":p_sid" => $value2['x_id']));
+            $value2['pinlunshu'] = $pingfennum;
+            //是否有优惠券优惠
+            if ($value2['x_youhuiquanstatus'] == '1') {
+                //查询优惠券是否存在
+                $fwyhq = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_youhuiquan") . " WHERE uniacid=:uniacid and y_id=:y_id", array(":uniacid" => $uniacid, ":y_id" => $value2['x_youhuiquan']));
+                if (empty($fwyhq)) {
+                    $value2['yhq_type'] = "false";
+                } else {
+                    $value2['yhq_type'] = "true";
+                    $value2['yhq_money'] = number_format($fwyhq['y_money'], 2);
+                }
+            } else {
+                $value2['yhq_type'] = "false";
+            }
+            //查询用户
+            $user = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " WHERE uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+            $morenzhekou = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_huiyuanset") . " WHERE uniacid=:uniacid", array(":uniacid" => $uniacid));
+            if ($user['u_type'] == '0') {
+                $value2['x_yjiage'] = $value2['x_jiage'] * $morenzhekou['hmrzk'];
+            } else {
+                if ($user['u_typeendtime'] > $time) {
+                    $zhekou = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_huiyuan") . " WHERE uniacid=:uniacid and h_id=:h_id", array(":uniacid" => $uniacid, ":h_id" => $user['u_type']));
+                    if ($zhekou['h_zhekou'] > 1) {
+                        $x_yjiage = $value2['x_jiage'] * $zhekou['h_zhekou'] * 0.1;
+                    } else {
+                        $x_yjiage = $value2['x_jiage'] * $zhekou['h_zhekou'];
+                    }
+                } else {
+                    $x_yjiage = $value2['x_jiage'] * $morenzhekou['hmrzk'];
+                }
+            }
+            $value2['x_yjiage'] = number_format($x_yjiage, 2);
+            // //查询评分
+            // $pingfencount = pdo_fetchall("SELECT sum(p_fenshu) as money FROM ".tablename('hyb_o2o_fuwupingjia')."where uniacid=:uniacid and p_sid=:p_sid",array(":uniacid"=>$uniacid,":p_sid"=>$value2['x_id']));
+            // $pingfennum = pdo_fetchcolumn("SELECT count(*)  FROM ".tablename('hyb_o2o_fuwupingjia')."where uniacid=:uniacid and p_sid=:p_sid",array(":uniacid"=>$uniacid,":p_sid"=>$value2['x_id']));
+            // $pingfen = $pingfencount[0]['money']/$pingfennum;
+            // $value2['pingfen'] =sprintf('%.1f',$pingfen);
+            // //查询商家
+            // $sj = pdo_fetch("SELECT * FROM ".tablename("hyb_o2o_shangjia")." WHERE uniacid=:uniacid and s_id=:s_id",array(":uniacid"=>$uniacid,":s_id"=>$value2['x_shangjia']));
+            // $value2['s_jing'] = $sj['jing'];
+            // $value2['s_wei'] = $sj['wei'];
+            // $value2['s_address']  = $sj['s_xxaddress'];
+            // //查询评论数
+            // $pinlunshu = pdo_fetchcolumn("SELECT count(*) FROM ".tablename("hyb_o2o_fuwupingjia")." WHERE uniacid=:uniacid and p_sid=:p_sid",array(":uniacid"=>$uniacid,":p_sid"=>$value2['x_id']));
+            // $value2['pinlunshu'] = $pinlunshu;
+            // //查询下单数
+            // $xiadancount = pdo_fetchcolumn("SELECT count(*) FROM ".tablename("hyb_o2o_orderfuwu")." WHERE uniacid=:uniacid and o_xid=:o_xid",array(":uniacid"=>$uniacid,":o_xid"=>$value2['x_id']));
+            // $value2['xiadancount'] = $xiadancount;
+            // //查询商家
+            // $fwsj = pdo_fetch("SELECT * FROM ".tablename("hyb_o2o_shangjia")." WHERE uniacid=:uniacid and s_id=:s_id",array(":uniacid"=>$uniacid,":s_id"=>$value2['x_shangjia']));
+            // $value2['s_name'] = $fwsj['s_name'];
+            // if (strpos($fwsj['s_thumb'],"http")===false){
+            //     $value2['s_thumb'] = $_W['attachurl'].$fwsj['s_thumb'];
+            // }else{
+            //     $value2['s_thumb'] = $fwsj['s_thumb'];
+            // }
+        }
+    }
+    output_data($xiangmu);
+}
+if ($op == 'search') {
+    //do:Jiansuo
+    $values = $_REQUEST['value'];
+    $city = $_REQUEST["city"];
+    if (empty($city)) {
+        $base = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_base") . " where uniacid=:uniacid ", array(":uniacid" => $uniacid));
+        $city = $base['city'];
+    }
+    //查询商家
+    $time = date("Y-m-d H:i:s", time());
+    $shangjia = pdo_fetchall("SELECT s_id FROM " . tablename("hyb_o2o_shangjia") . " WHERE uniacid=:uniacid and s_address like '%{$city}%' and s_status=:s_status and ruzhu_endtime!=:ruzhu_endtime and ruzhu_endtime>'" . $time . "'", array(":uniacid" => $uniacid, ":s_status" => "审核通过", ":ruzhu_endtime" => "已到期"));
+    if (!empty($shangjia)) {
+        foreach ($shangjia as &$value) {
+            $s_id[] = $value['s_id'];
+        }
+        $s_id = implode(",", $s_id);
+        $xiangmu = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " WHERE uniacid=:uniacid and x_shangjia in({$s_id}) and x_name like '%" . $values . "%' ", array(":uniacid" => $uniacid));
+        if (!empty($xiangmu)) {
+            foreach ($xiangmu as &$value2) {
+                if (strpos($value2['x_thumb'], "http") === false) {
+                    $value2['x_thumb'] = $_W['attachurl'] . $value2['x_thumb'];
+                }
+                $value2['label'] = unserialize($value2['label']);
+                //查询商家
+                $sj = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " WHERE uniacid=:uniacid and s_id=:s_id", array(":uniacid" => $uniacid, ":s_id" => $value2['x_shangjia']));
+                $value2['s_name'] = $sj['s_name'];
+                $value2['s_jing'] = $sj['jing'];
+                $value2['s_wei'] = $sj['wei'];
+                $value2['s_address'] = $sj['s_xxaddress'];
+                if (strpos($sj['s_thumb'], "http") === false) {
+                    $value2['s_thumb'] = $_W['attachurl'] . $sj['s_thumb'];
+                } else {
+                    $value2['s_thumb'] = $sj['s_thumb'];
+                }
+                //查询评论数
+                $pinlunshu = pdo_fetchcolumn("SELECT count(*) FROM " . tablename("hyb_o2o_fuwupingjia") . " WHERE uniacid=:uniacid and p_sid=:p_sid", array(":uniacid" => $uniacid, ":p_sid" => $value2['x_id']));
+                $value2['pinlunshu'] = $pinlunshu;
+                //查询下单数
+                $xiadancount = pdo_fetchcolumn("SELECT count(*) FROM " . tablename("hyb_o2o_orderfuwu") . " WHERE uniacid=:uniacid and o_xid=:o_xid", array(":uniacid" => $uniacid, ":o_xid" => $value2['x_id']));
+                $value2['xiadancount'] = $xiadancount;
+            }
+        }
+    } else {
+        $xiangmu = [];
+    }
+    // var_dump($xiangmu);
+}
+include $this->template('fuwu_list/fuwu_list');

+ 241 - 0
server/addons/hyb_o2o/inc/mobile/fw_refill.inc.php

xqd
@@ -0,0 +1,241 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$u_id = $_SESSION['u_id'];
+// error_reporting(E_ALL& ~E_NOTICE);
+if ($op == 'display') {
+    //Ordewrfwpp
+    $x_id = $_REQUEST['x_id'];
+    // $openid = $_REQUEST['openid'];
+    $leixing = $_REQUEST['leixing'];
+    $list = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " where uniacid=:uniacid and x_id=:x_id", array(":uniacid" => $uniacid, ":x_id" => $x_id));
+    if (strpos($list['x_thumb'], "http") === false) {
+        $list['x_thumb'] = $_W['attachurl'] . $list['x_thumb'];
+    }
+    $list['x_thumbs'] = unserialize($list['x_thumbs']);
+    $user = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+    /*权益*/
+    //查询用户会员卡
+    $newtime = date("Y-m-d H:i:s", time());
+    if ($list['x_pay_type'] == '上门估价') {
+        if ($leixing == 'xiadan') {
+            $list['huiyuanquanyi'] = "false";
+        }
+    } else {
+        if ($user['u_type'] == '0') {
+            $list['huiyuanquanyi'] = "false";
+        } else {
+            if ($user['u_typeendtime'] < $newtime) {
+                $list['huiyuanquanyi'] = "false";
+            } else {
+                $userhuiyuanka = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_huiyuan") . " WHERE uniacid=:uniacid and h_id=:h_id", array(":uniacid" => $uniacid, ":h_id" => $user['u_type']));
+                if (!empty($userhuiyuanka)) {
+                    $huiyuankaset = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_huiyuanset") . " WHERE uniacid=:uniacid", array(":uniacid" => $uniacid));
+                    $userhuiyuanka['h_thumb'] = $_W['attachurl'] . $huiyuankaset['hthumb'];
+                    $userhuiyuanka['h_endtime'] = $user['u_typeendtime'];
+                    if ($userhuiyuanka['h_zhekou'] < 1) {
+                        $userhuiyuanka['h_zhekou'] = $userhuiyuanka['h_zhekou'] * 10;
+                    }
+                    $list['huiyuanquanyi'] = "true";
+                } else {
+                    $list['huiyuanquanyi'] = "false";
+                }
+            }
+        }
+    }
+    $newtime = date("Y-m-d H:i:s", time());
+    //查询用户次卡
+    $cika = $list['x_cika'];
+    // $usercika = pdo_fetchall("SELECT * FROM ".tablename("hyb_o2o_usercika")." WHERE c
+    $usercika = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_usercika") . " WHERE uniacid=:uniacid and cid in({$cika}) and u_id=:u_id and synum>0 and cendtime>:time", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":time" => $newtime));
+    // $usercika = pdo_fetchall("select * from ".tablename("hyb_o2o_usercika")."where uniacid=:uniacid");
+    if (!empty($usercika)) {
+        foreach ($usercika as &$value2) {
+            $ka = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_cika") . " WHERE uniacid=:uniacid and c_id=:c_id", array(":uniacid" => $uniacid, ":c_id" => $value2['cid']));
+            $value2['c_name'] = $ka['c_name'];
+            $value2['c_thumb'] = $_W['attachurl'] . $ka['c_thumb'];
+            $value2['c_money'] = $ka['c_money'];
+            $value2['c_kahao'] = $ka['c_kahao'];
+            $value2['time'] = substr($value2['time'], 0, strrpos($value2['time'], " "));
+            $value2['kcnum'] = $value2['countnum'] - $value2['synum'];
+        }
+    }
+    //查询用户优惠券
+    $useryouhuiquan = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_useryouhuiquan") . " where uniacid=:uniacid and x_id=:x_id and u_id=:u_id and y_endtime>:time and y_starttime<=:time and type=:type", array(":uniacid" => $uniacid, ":x_id" => $list['x_id'], ":u_id" => $u_id, ":time" => $newtime, ":type" => "未使用"));
+    if (!empty($useryouhuiquan)) {
+        foreach ($useryouhuiquan as &$value3) {
+            $yhq = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_youhuiquan") . " WHERE uniacid=:uniacid and y_id=:y_id", array(":uniacid" => $uniacid, ":y_id" => $value3['y_name']));
+            $value3['yhq_money'] = $yhq['y_money'];
+            $value3['yhq_name'] = $yhq['y_name'];
+            $value3['yhq_shuoming'] = $yhq['y_shuoming'];
+            $value3['yhq_endtime'] = $yhq['y_endtime'];
+            $value3['yhq_yaoqiu'] = $yhq['y_yaoqiu'];
+        }
+    }
+    //查询商家
+    $shangjia = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " where uniacid=:uniacid and s_id=:s_id", array(":uniacid" => $uniacid, ":s_id" => $list['x_shangjia']));
+    //查询商家员工
+    $yaungong = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_yuangong") . " where uniacid=:uniacid and y_sjname=:y_sjname and y_styles=:y_styles and y_typs=:y_typs and y_jin=0 and y_rz=0", array(":uniacid" => $uniacid, ":y_sjname" => $shangjia['s_id'], ":y_styles" => "审核通过", ":y_typs" => "空闲中"));
+    if (!empty($yaungong)) {
+        foreach ($yaungong as &$values) {
+            $values['y_jineng'] = unserialize($values['y_jineng']);
+            if (strpos($values['y_thumb'], "http") === false) {
+                $values['y_thumb'] = $_W['attachurl'] . $values['y_thumb'];
+            }
+            $values['y_fwqy'] = unserialize($values['y_fwqy']);
+            $values['fuwuquyu'] = implode(",", $values['y_fwqy']);
+            //查询接单数
+            $jiedan = pdo_fetchcolumn("SELECT count(*) FROM " . tablename("hyb_o2o_orderfuwu") . " WHERE uniacid=:uniacid and o_fwry_id=:o_fwry_id", array(":uniacid" => $uniacid, ":o_fwry_id" => $values['y_id']));
+            $values['jiedan'] = $jiedan;
+            //查询服务评分
+            $fwpf = pdo_fetchall("SELECT count(*) as pingjianum,num(p_fenshu) as pingfe FROM " . tablename("hyb_o2o_fuwupingjia") . " WHERE uniacid=:uniacid and p_yid=:p_yid", array(":uniacid" => $uniacid, ":p_yid" => $values['y_id']));
+            $pingfen = $fwpf[0]['pingfe'] / $orderpingfen[0]['pingjianum'];
+            if ($pingfen == '0') {
+                $values['pingfen'] = 5;
+            } else {
+                $values['pingfen'] = ceil($pingfen);
+            }
+        }
+    }
+    $list['userhuiyuanka'] = $userhuiyuanka;
+    $list['useryouhuiquan'] = $useryouhuiquan;
+    $list['usercika'] = $usercika;
+    $list['yuangong'] = array_values($yaungong);
+    //
+    $x_id = $_GPC['x_id'];
+    $j = 7;
+    $times = array();
+    $weekarray = array("日", "一", "二", "三", "四", "五", "六", "日", "一", "二", "三", "四", "五", "六");
+    for ($i = 0; $i < $j; $i++) {
+        $times['week'][$i]['week'] = "星期" . $weekarray[date("w") + $i];
+        $times['week'][$i]['days'] = date("Y-m-d", strtotime("+" . $i . " day"));
+    }
+    //获取时间对应的次数
+    $countarray = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " WHERE uniacid=:uniacid and x_id=:x_id ", array(":uniacid" => $uniacid, ":x_id" => $_GPC['x_id']));
+    if (!$countarray['x_timecontent']) {
+        $countarray['x_timecontent'] = "a:3:{s:5:\"start\";a:1:{i:0;s:5:\"08:00\";}s:3:\"end\";a:1:{i:0;s:5:\"18:00\";}s:6:\"counts\";a:1:{i:0;s:2:\"10\";}}";
+    }
+    $countime = array();
+    $allcount = unserialize($countarray['x_timecontent']);
+    $times['count'] = [];
+    foreach ($allcount['start'] as $key => $value) {
+        $times['count'][$key]['time'] = $value . "-" . $allcount['end'][$key];
+        //获取剩余次数
+        $count = pdo_fetchcolumn("SELECT count(*) FROM " . tablename("hyb_o2o_fuwu_time") . " WHERE uniacid=:uniacid and date=:date and time=:time and status=1 and x_id=:x_id", array(":x_id" => $x_id, ":uniacid" => $uniacid, ":date" => date("Y-m-d", strtotime("+1 day")), ":time" => $times['count'][$key]['time']));
+        $times['count'][$key]['count'] = $allcount['counts'][$key] - $count;
+        if ($times['count'][$key]['count'] < 1) {
+            unset($times['count'][$key]);
+        }
+    }
+    // var_dump($list);
+}
+if ($op == 'add') {
+    //Dingdanfwx
+    $_REQUEST['count_money'] = str_replace('¥', '', $_REQUEST['count_money']);
+    $openid = $_REQUEST['openid'];
+    $x_id = $_REQUEST['x_id'];
+    $fwryid = $_REQUEST['fwryid'];
+    //服务人员id
+    $ordersn = date("Ymd") . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT);
+    //查询项目
+    $xiangmu = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu") . " where uniacid=:uniacid and x_id=:x_id", array(":uniacid" => $uniacid, ":x_id" => $x_id));
+    //查询用户
+    $user = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " WHERE uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, "u_id" => $u_id));
+    //核销码数字
+    $hexiaomashuzi = time() . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT);
+    //获取经纬度
+    /*        $base = pdo_fetch("SELECT * FROM ".tablename("hyb_o2o_base")." where uniacid=:uniacid ",array(":uniacid"=>$uniacid));
+            if ($base['gaodekey']) {
+                //获取收货地址经纬度
+                $addressUrl="https://restapi.amap.com/v3/geocode/geo?key=".$base['gaodekey']."&address=".$_REQUEST['location'].$_REQUEST['detailInfo'];
+            }else{
+                //获取收货地址经纬度
+                $addressUrl="https://restapi.amap.com/v3/geocode/geo?key=29c069a05a449fcea6caf90030902d98&address=".$_REQUEST['location'].$_REQUEST['detailInfo'];
+            }*/
+    $getArr = array();
+    // $localtionlat=json_decode($this->send_post($addressUrl,$getArr,"GET"),true);
+    $service_info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_yuangong") . " WHERE y_id=:y_id ", array(":y_id" => $fwryid));
+    $service_id = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " WHERE u_id=:u_id ", array(":u_id" => $service_info['u_id']));
+    if ($_REQUEST['liuyan'] == 'undefined') {
+        $_REQUEST['liuyan'] = "";
+    }
+    $data = array("uniacid" => $uniacid, "openid" => $user['openid'], "ordersn" => $ordersn, "o_name" => $_REQUEST['name'], "o_telphone" => $_REQUEST['tel'], "o_address" => $_REQUEST['o_address'], "o_xxaddress" => $_REQUEST['detailInfo'], "o_xid" => $_REQUEST['x_id'], "o_xiangmu_name" => $xiangmu['x_name'], "o_xiangmu_thumb" => $_W['attachurl'] . $xiangmu['x_thumb'], "o_xiangmu_money" => $xiangmu['x_jiage'], "o_xiangmu_xingshi" => $xiangmu['x_xingshi'], "o_num" => "1", "o_yy_riqi" => $_REQUEST['yydate'] . " " . $_REQUEST['yytime'], "o_fwry" => $service_info['y_name'], "o_fwry_id" => $service_id['u_id'], "o_beizhu" => $_REQUEST['liuyan'], "o_xdtime" => date("Y-m-d H:i:s", time()), "o_store" => $xiangmu['x_shangjia'], "o_hexiaomashuzi" => $hexiaomashuzi, "o_localtion" => $_REQUEST['o_localtion'], "o_uid" => $user['u_id']);
+    if ($_REQUEST['guige'] == '无') {
+        $data['o_xiangmu_guige'] = "";
+        $data['o_xiangmu_guigemoney'] = "0";
+    } else {
+        $data['o_xiangmu_guige'] = $_REQUEST['guigexiang'];
+        $data['o_xiangmu_guigemoney'] = $_REQUEST['guigeprice'];
+    }
+    if ($xiangmu['x_pay_type'] == '定金支付') {
+        $count_money = $_REQUEST['count_money'];
+        $data["o_count_money"] = $count_money;
+        $o_ding_money = $count_money * $xiangmu['x_pay_bili'] * 0.01;
+        $o_sheng_money = $count_money - $o_ding_money;
+        $data["o_ding_money"] = $o_ding_money;
+        $data["o_sheng_money"] = $o_sheng_money;
+        $data["o_pay_type"] = "定金支付";
+        $data["o_type"] = "未支付";
+    }
+    if ($xiangmu['x_pay_type'] == '全额付款') {
+        $count_money = $_REQUEST['count_money'];
+        $data["o_count_money"] = $count_money;
+        $data["o_ding_money"] = "0";
+        $data["o_sheng_money"] = "0";
+        $data["o_pay_type"] = "全额付款";
+        $data["o_type"] = "未支付";
+    }
+    if ($xiangmu['x_pay_type'] == '上门估价') {
+        $data['o_shangmen_money'] = $xiangmu['x_pay_smgj'];
+        $data["o_count_money"] = "0";
+        $data["o_ding_money"] = "0";
+        $data["o_sheng_money"] = "0";
+        $data["o_pay_type"] = "上门估价";
+        $data["o_pay_types"] = "0";
+        $data["o_type"] = "未支付";
+    }
+    if ($_REQUEST['is_hyk_money'] > 0) {
+        $data["o_huiyaunyouhui"] = "1";
+        $data['o_huiyuanyouhui_money'] = $_REQUEST['is_hyk_money'];
+        $data["o_pay_types"] = "0";
+        $data["o_type"] = "未支付";
+    }
+    if ($_REQUEST['is_yhq_money'] > 0) {
+        $data["o_youhuiquanyouhui"] = "1";
+        $data['o_youhuiquanyouhui_money'] = $_REQUEST['is_yhq_money'];
+        $data['o_youhuiquanyouhui_id'] = $_REQUEST['is_yhq_id'];
+        $data["o_pay_types"] = "0";
+        $data["o_type"] = "未支付";
+    }
+    if (!empty($_REQUEST['is_ck_name'])) {
+        $cikaname = $_REQUEST['is_ck_name'];
+        $cikalist = $xiangmu['x_cika'];
+        $cikainfo = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_cika") . " WHERE uniacid=:uniacid and c_id in({$cikalist}) and c_name=:c_name", array(":uniacid" => $uniacid, ":c_name" => $cikaname));
+        $data["o_cikayouhui"] = "1";
+        $data['o_cikayouhui_id'] = $cikainfo['c_id'];
+        $data['o_cikayouhui_name'] = $cikainfo['c_name'];
+        $data["o_type"] = "已付款";
+        $data["o_pay_types"] = "1";
+        $data["o_pay_typess"] = "次卡支付";
+        //扣除次卡次数
+        $usercika = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_usercika") . " WHERE uniacid=:uniacid and openid=:openid and cid=:cid", array(":uniacid" => $uniacid, ":openid" => $openid, ":cid" => $cikainfo['c_id']));
+        pdo_update("hyb_o2o_usercika", array("synum -=" => "1"), array("id" => $usercika['id']));
+    }
+    $res = pdo_insert("hyb_o2o_orderfuwu", $data);
+    $o_id = pdo_insertid();
+    //插入服务订单统计表
+    $service['date'] = $_REQUEST['yydate'];
+    $service['time'] = $_REQUEST['yytime'];
+    $service['uniacid'] = $uniacid;
+    $service['o_id'] = $o_id;
+    $service['x_id'] = $_REQUEST['x_id'];
+    $ordercountres = pdo_insert("hyb_o2o_fuwu_time", $service);
+    /*var_dump($xiangmu);
+    var_dump($data);*/
+    output_data(array('o_id' => $o_id, 'otype' => $data["o_type"]));
+}
+if ($op == 'yuangong') {
+}
+include $this->template('fw_refill/fw_refill');

+ 41 - 0
server/addons/hyb_o2o/inc/mobile/fxyj.inc.php

xqd
@@ -0,0 +1,41 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$u_id = $_SESSION['u_id'];
+$userfenxiao = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userfenxiao") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+if ($op == 'display') {
+    // $openid = $_REQUEST['openid'];
+    //查询提现协议
+    $fenxiaoshezhi = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fenxiao") . " where uniacid=:uniacid ", array(":uniacid" => $uniacid));
+    $userfenxiao['txsmoney'] = $fenxiaoshezhi['tx_money'];
+    $userfenxiao['txsxf'] = $fenxiaoshezhi['tx_rate'];
+    $userfenxiao['txxy'] = html_entity_decode($fenxiaoshezhi['tx_details']);
+    // var_dump($userfenxiao);
+}
+if ($op == 'add') {
+    $openid = $_REQUEST['openid'];
+    //查询分销商
+    $fenxiao = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userfenxiao") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+    $money = $_REQUEST['je'];
+    $shouxufeis = $money * $userfenxiao['shouxufei'] * 0.01;
+    $shouxufei = sprintf("%.2f", $shouxufeis);
+    $counttx = $money + $shouxufei;
+    if ($counttx > $fenxiao['f_money']) {
+        $tx_money = $money - $shouxufei;
+        $type = "1";
+        $countmoney = $money;
+    } else {
+        $tx_money = $money;
+        $type = "2";
+        $countmoney = $money + $shouxufei;
+    }
+    $u_money = $fenxiao['f_money'] - $countmoney;
+    $datas = array("f_money" => $u_money);
+    pdo_update("hyb_o2o_userfenxiao", $datas, array("f_id" => $fenxiao['f_id']));
+    $data = array("uniacid" => $uniacid, "t_fopenid" => $openid, "u_id" => $u_id, "t_fid" => $fenxiao['f_id'], "t_name" => $fenxiao['f_name'], "t_money" => $tx_money, "t_shouxufei" => $shouxufei, "t_time" => date("Y-m-d H:i:s", time()), "t_status" => "待审核", "t_type" => $type);
+    pdo_insert("hyb_o2o_fenxiaotixian", $data);
+    output_data("提现成功");
+}
+include $this->template('fxyj/fxyj');

+ 73 - 0
server/addons/hyb_o2o/inc/mobile/goods_page.inc.php

xqd
@@ -0,0 +1,73 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$u_id = $_SESSION['u_id'];
+$city = $_COOKIE['city'];
+// error_reporting(E_ALL);
+if ($op == 'display') {
+    //查找会员折扣
+    $set = pdo_fetch("SELECT hname,hmrzk,hmrkk FROM " . tablename("hyb_o2o_huiyuanset") . " WHERE uniacid=:uniacid", array(":uniacid" => $uniacid));
+    $shangping = m('shangping');
+    $goods_info = $shangping->shangpingxq();
+    // $goods_info['g_hymoney'] =number_format($goods_info['g_jiage']*$set['hmrzk'],2);
+    $goods_info['g_hymoney'] = $goods_info['g_jiage'];
+    $yhj_list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_youhuiquan") . " where uniacid=:uniacid ", array(":uniacid" => $uniacid));
+    $yhj_user = pdo_fetchall("SELECT y_id FROM " . tablename("hyb_o2o_useryouhuiquan") . " WHERE uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+    $yhj_list_user = array();
+    if (!empty($yhj_user)) {
+        foreach ($yhj_user as $key => $value) {
+            array_push($yhj_list_user, $value['y_id']);
+        }
+    }
+    $baozhang = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_goods_baozhang") . " where uniacid=:uniacid", array(":uniacid" => $uniacid));
+    $user_info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " where u_id=:u_id and uniacid=:uniacid ", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+    $citys = pdo_fetch("SELECT id FROM " . tablename("hyb_o2o_city") . " where uniacid=:uniacid and name=:name", array(":uniacid" => $uniacid, ":name" => $city));
+    $goods_list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_goods") . " where uniacid=:uniacid and g_city=:g_city and g_status=1 and g_tuijian=1 order by g_ids desc limit 4", array(":uniacid" => $uniacid, "g_city" => $citys['id']));
+    if (empty($goods_list)) {
+        $goods_list = [];
+    } else {
+        foreach ($goods_list as &$value) {
+            $value['g_thumb'] = $_W['attachurl'] . $value['g_thumb'];
+            $value['g_hymoney'] = number_format($value['g_jiage'] * $set['hmrzk'], 2);
+        }
+    }
+    $cartnum = pdo_fetchcolumn("SELECT count(*) FROM " . tablename("hyb_o2o_cart") . " WHERE uniacid=:uniacid and (openid=:openid or u_id=:u_id)", array(":uniacid" => $uniacid, ":openid" => $user_info['openid'], ":u_id" => $user_info['u_id']));
+}
+//领优惠券
+if ($op == 'yhj') {
+    $y_id = $_GPC['y_id'];
+    $x_id = $_GPC['x_id'];
+    // error_reporting(E_ALL);
+    if (empty($u_id)) {
+        output_error("请登录后领取");
+    }
+    if ($y_id > 0) {
+        $youhuijuan = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_youhuiquan") . " WHERE uniacid=:uniacid and y_id=:y_id", array(":uniacid" => $uniacid, ":y_id" => $y_id));
+    } else {
+        output_error("失败,没有找到优惠券");
+    }
+    if (empty($x_id)) {
+        $youhuijuan_info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_useryouhuiquan") . " WHERE uniacid=:uniacid and y_name=:y_id and u_id=:u_id", array(":uniacid" => $uniacid, ":y_id" => $y_id, ":u_id" => $u_id));
+    } else {
+        $youhuijuan_info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_useryouhuiquan") . " WHERE uniacid=:uniacid and y_name=:y_id and x_id=:x_id and x_id=:x_id", array(":uniacid" => $uniacid, ":y_id" => $y_id, ":u_id" => $u_id, ":x_id" => $x_id));
+    }
+    if (!empty($youhuijuan_info)) {
+        output_error("已领取过,只可领取一次");
+    }
+    $data = array();
+    $data['u_id'] = $u_id;
+    $data['uid'] = $u_id;
+    $data['openid'] = $_GPC['openid'];
+    $data['uniacid'] = $uniacid;
+    // $data['y_id'] = $youhuijuan['y_id'];
+    $data['y_name'] = $youhuijuan['y_id'];
+    $data['x_id'] = $x_id;
+    $data['y_endtime'] = $youhuijuan['y_endtime'];
+    $data['y_starttime'] = $youhuijuan['y_starttime'];
+    $data['type'] = "未使用";
+    pdo_insert("hyb_o2o_useryouhuiquan", $data);
+    output_data("领取成功");
+}
+include $this->template('goods_page/goods_page');

+ 10 - 0
server/addons/hyb_o2o/inc/mobile/hdsz.inc.php

xqd
@@ -0,0 +1,10 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+if ($op == 'display') {
+}
+if ($op == 'reg') {
+}
+include $this->template('hdsz/hdsz');

+ 121 - 0
server/addons/hyb_o2o/inc/mobile/in_business.inc.php

xqd
@@ -0,0 +1,121 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$u_id = $_SESSION['u_id'];
+if ($op == 'display') {
+    $rzfw_list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_parentid=0", array(":uniacid" => $uniacid));
+    $rzsj_list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_shangjiaruzhu") . " where uniacid=:uniacid", array(":uniacid" => $uniacid));
+    if (!empty($rzsj_list)) {
+        foreach ($rzsj_list as &$value) {
+            $value['r_content'] = $value['r_time'] . "天/(¥" . $value['r_money'] . ")";
+        }
+    }
+    $info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_base") . " where uniacid=:uniacid", array(":uniacid" => $uniacid));
+    $info['s_ttthumb'] = $_W['attachurl'] . $info['s_ttthumb'];
+    $info['erweima'] = $_W['attachurl'] . $info['erweima'];
+    if (empty($info['showblydthumb'])) {
+        $info['showblyd'] = "false";
+    } else {
+        $info['showblyd'] = "true";
+        $info['showblydthumb'] = $_W['attachurl'] . $info['showblydthumb'];
+    }
+    $info['thumb'] = unserialize($info['thumb']);
+    foreach ($info['thumb'] as &$value) {
+        $value = $_W['attachurl'] . $value;
+    }
+    $shangjia_model = m(shangjia);
+    $shangjia_info = $shangjia_model->shangjiaxq();
+    // var_dump($shangjia_info);
+}
+// error_reporting(E_ALL);
+if ($op == 'post') {
+    // var_dump($_REQUEST);EXIT;
+    $_REQUEST['dizhi'] = $_COOKIE['city'];
+    $ruzhu_id = $_REQUEST['ruzhu_id'];
+    $imgpath = $_REQUEST['imgpath'];
+    $imgpaths = serialize($imgpath);
+    $label = $_REQUEST['label'];
+    $label = serialize($label);
+    //查询入驻
+    $ruzhu = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjiaruzhu") . " WHERE uniacid=:uniacid and r_id=:r_id", array(":uniacid" => $uniacid, ":r_id" => $ruzhu_id));
+    $ruzhutime = $ruzhu['r_time'];
+    if ($ruzhutime > 1) {
+        $ruzhu_endtime = date('Y-m-d H:i:s', strtotime("+{$ruzhutime} day"));
+    } else {
+        $ruzhudate = $ruzhutime * 24;
+        $ruzhu_endtime = date('Y-m-d H:i:s', strtotime("+{$ruzhudate} hours"));
+    }
+    //入驻
+    $data = array("u_id" => $u_id, "uniacid" => $uniacid, "s_name" => $_REQUEST['s_name'], "s_u_name" => $_REQUEST['s_u_name'], "s_u_openid" => $_REQUEST['openid'], "s_telphone" => $_REQUEST['s_telphone'], "s_content" => $_REQUEST['s_content'], "s_type" => trim($_REQUEST['s_t_name']), "s_yingyetime" => $_REQUEST['s_time'], "s_address" => $_REQUEST['s_address'], "s_xxaddress" => $_REQUEST['s_xxaddress'], "jing" => $_REQUEST['jing'], "wei" => $_REQUEST['wei'], "s_thumb" => $_REQUEST['logo'], "s_zhizhao" => $_REQUEST['zhizhao'], "s_imgpath" => $imgpaths, "ruzhu_money" => $_REQUEST['ruzhu_money'], "ruzhu_endtime" => $ruzhu_endtime, "s_status" => "未支付", "s_tuijian" => "否", "s_time" => date('Y-m-d H:i:s', time()), "s_idcard" => $_REQUEST['Idcard'], "s_idcard2" => $_REQUEST['Idcard2'], "label" => $label, "s_dizhi" => $_REQUEST['dizhi'], "ruzhu_info" => $_REQUEST['ruzhu_info']);
+    //平台修改
+    $data2 = array("u_id" => $u_id, "uniacid" => $uniacid, "s_name" => $_REQUEST['s_name'], "s_u_name" => $_REQUEST['s_u_name'], "s_telphone" => $_REQUEST['s_telphone'], "s_content" => $_REQUEST['s_content'], "s_type" => $_REQUEST['s_t_name'], "s_yingyetime" => $_REQUEST['s_time'], "s_address" => $_REQUEST['s_address'], "s_xxaddress" => $_REQUEST['s_xxaddress'], "jing" => $_REQUEST['jing'], "wei" => $_REQUEST['wei'], "s_thumb" => $_REQUEST['logo'], "s_zhizhao" => $_REQUEST['zhizhao'], "s_imgpath" => $imgpaths, "s_status" => "待审核", "s_tuijian" => "否", "s_idcard" => $_REQUEST['Idcard'], "s_idcard2" => $_REQUEST['Idcard2'], "label" => $label, "s_dizhi" => $_REQUEST['dizhi']);
+    //非平台修改
+    $data3 = array("uniacid" => $uniacid, "s_name" => $_REQUEST['s_name'], "s_u_name" => $_REQUEST['s_u_name'], "s_u_openid" => $_REQUEST['openid'], "s_telphone" => $_REQUEST['s_telphone'], "s_content" => $_REQUEST['s_content'], "s_yingyetime" => $_REQUEST['s_time'], "s_address" => $_REQUEST['s_address'], "s_xxaddress" => $_REQUEST['s_xxaddress'], "jing" => $_REQUEST['jing'], "wei" => $_REQUEST['wei'], "s_thumb" => $_REQUEST['logo'], "s_imgpath" => $imgpaths, "s_idcard" => $_REQUEST['Idcard'], "s_idcard2" => $_REQUEST['Idcard2'], "label" => $label, "s_zhizhao" => $_REQUEST['zhizhao'], "s_dizhi" => $_REQUEST['dizhi']);
+    $rz = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " WHERE uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+    if (empty($rz)) {
+        if ($_REQUEST['typs'] == "发布") {
+            $res = pdo_insert("hyb_o2o_shangjia", $data);
+            $o_id = pdo_insertid();
+            //直推奖返佣
+            //查询用户是否为分销商
+            $fenxiaoshang = pdo_fetch('SELECT * FROM ' . tablename("hyb_o2o_userfenxiao") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+            if (!empty($fenxiaoshang)) {
+                //直推者
+                $zhituizhe = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userfenxiao") . " where uniacid=:uniacid and f_id=:f_id", array(":uniacid" => $uniacid, ":f_id" => $fenxiaoshang['f_parentid']));
+                if (!empty($zhituizhe)) {
+                    $fenxiaoset = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fenxiao") . " WHERE uniacid=:uniacid=:uniacid", array(":uniacid" => $uniacid));
+                    $yongjin = $ruzhu['r_money'] * $fenxiaoset['sjzt'];
+                    $fanyong = array("uniacid" => $uniacid, "yongjin" => $yongjin, "parentid" => $zhituizhe['f_id'], "parentopenid" => $zhituizhe['f_openid'], "u_id" => $zhituizhe['u_id'], "time" => date("Y-m-d H:i:s", time()), "yonghu" => $fenxiao['f_name'], "content" => "商家直推奖");
+                    pdo_insert("hyb_o2o_fenxiaoyongjin", $fanyong);
+                }
+            }
+            output_data($o_id);
+        } elseif ($_REQUEST['typs'] == "修改") {
+            if ($rz['pingtai'] == "0") {
+                $res = pdo_update("hyb_o2o_shangjia", $data2, array("s_id" => $_REQUEST['s_id']));
+            } elseif ($rz['pingtai'] == "1") {
+                $res = pdo_update("hyb_o2o_shangjia", $data3, array("s_id" => $_REQUEST['s_id']));
+                $data4 = array("uniacid" => $uniacid, "name" => $_REQUEST['s_name'], "thumb" => $_REQUEST['logo'], "thumbs" => $imgpaths, "content" => $_REQUEST['s_content'], "xaddress" => $_REQUEST['s_xxaddress'], "address" => $_REQUEST['s_address']);
+                pdo_update("hyb_o2o_mendian", $data4, array("uniacid" => $uniacid));
+            }
+        }
+    } else {
+        if ($rz['pingtai'] == "0") {
+            $res = pdo_update("hyb_o2o_shangjia", $data2, array("s_id" => $_REQUEST['s_id']));
+        } elseif ($rz['pingtai'] == "1") {
+            $res = pdo_update("hyb_o2o_shangjia", $data3, array("s_id" => $_REQUEST['s_id']));
+            $data4 = array("uniacid" => $uniacid, "name" => $_REQUEST['s_name'], "u_id" => $u_id, "thumb" => $_REQUEST['logo'], "thumbs" => $imgpaths, "content" => $_REQUEST['s_content'], "xaddress" => $_REQUEST['s_xxaddress'], "address" => $_REQUEST['s_address']);
+            pdo_update("hyb_o2o_mendian", $data4, array("uniacid" => $uniacid));
+        }
+    }
+    if ($rz['pingtai'] == "0") {
+        //查询用户信息
+        $user = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+        $save = pdo_update("hyb_o2o_userinfo", array("u_shangjia" => "未支付", "u_yuangong" => "0"), array("u_id" => $user['u_id']));
+        /*短信通知平台管理员*/
+        //查询平台信息
+        $pingtai = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " where uniacid=:uniacid and pingtai=1", array(":uniacid" => $uniacid));
+        require_once IA_ROOT . '/addons/hyb_o2o/inc/func/SignatureHelper.php';
+        $params = array();
+        $aliduanxin = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_news") . " WHERE uniacid=:uniacid ", array("uniacid" => $uniacid));
+        $accessKeyId = $aliduanxin['accessKeyId'];
+        $accessKeySecret = $aliduanxin['accessKeySecret'];
+        $params["PhoneNumbers"] = $pingtai['s_telphone'];
+        //接收人手机号
+        $params["SignName"] = $aliduanxin['SignName'];
+        $params["TemplateCode"] = $aliduanxin['sjrztz'];
+        $params['TemplateParam'] = array("product" => "sms");
+        if (!empty($params["TemplateParam"]) && is_array($params["TemplateParam"])) {
+            $params["TemplateParam"] = json_encode($params["TemplateParam"]);
+        }
+        $helper = new SignatureHelper();
+        $content = $helper->request($accessKeyId, $accessKeySecret, "dysmsapi.aliyuncs.com", array_merge($params, array("RegionId" => "cn-hangzhou", "Action" => "SendSms", "Version" => "2017-05-25")));
+    }
+    output_data('修改成功');
+    die;
+}
+if ($op == 'reg') {
+}
+include $this->template('in_business/in_business');

+ 223 - 0
server/addons/hyb_o2o/inc/mobile/index.inc.php

xqd
@@ -0,0 +1,223 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$city = $_COOKIE['city'];
+$u_id = $_SESSION['u_id'];
+if ($op == 'display') {
+    $wxinfo = $this->getSignPackage();
+    if (!empty($city) && $city != '全国') {
+        $where_c = "and city='{$city}'";
+        $where_s = "like '%{$city}%'";
+    }
+    //商家幻灯片
+    $sj_list = pdo_fetch("SELECT thumb FROM " . tablename("hyb_o2o_base") . " where uniacid=:uniacid", array(":uniacid" => $uniacid));
+    $sj_list['s_ttthumb'] = $_W['attachurl'] . $sj_list['s_ttthumb'];
+    $sj_list['thumb'] = unserialize($sj_list['thumb']);
+    foreach ($sj_list['thumb'] as &$value) {
+        $value = $_W['attachurl'] . $value;
+    }
+    //服务导航分类
+    $fw_style_list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " where uniacid=:uniacid and xt_parentid=0 and xt_tuijian=1 order by xt_ids desc ", array(":uniacid" => $uniacid));
+    foreach ($fw_style_list as &$value) {
+        $value['xt_thumb'] = $_W['attachurl'] . $value['xt_thumb'];
+        if ($value['xt_tuijian_fabu'] == "1") {
+            $erji = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fuwu_type") . " WHERE uniacid=:uniacid and xt_id=:xt_id", array(":uniacid" => $uniacid, ":xt_id" => $value['xt_tzej']));
+            if (empty($erji)) {
+                $value['tz_ejname'] = "";
+            } else {
+                $value['tz_ejname'] = $erji['xt_name'];
+            }
+        }
+    }
+    $user = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " WHERE uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+    //技师
+    $time = date("Y-m-d H:i:s", time());
+    // error_reporting(E_ALL);
+    $js_list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_yuangong") . " where uniacid=:uniacid and y_rz=1 and y_endtime!=:y_endtime and y_endtime>'" . $time . "' and y_styles=:y_styles and  y_tuijian=:y_tuijian {$where_c}", array(":uniacid" => $uniacid, ":y_endtime" => "已到期", "y_styles" => "审核通过", ":y_tuijian" => "是"));
+    if (!empty($js_list)) {
+        foreach ($js_list as &$value) {
+            $value['y_label'] = unserialize($value['y_label']);
+            $value['y_jiedangonglishu'] = substr($value['y_jdnum'], 0, strrpos($value['y_jdnum'], "公里"));
+            $orderpingfen = pdo_fetchall("SELECT count(*) as pingfennum,sum(zonghepf) as pingfe FROM " . tablename("hyb_o2o_jishiyuyuepingjia") . " WHERE uniacid=:uniacid and (js_openid=:js_openid or js_id=:js_id)", array(":uniacid" => $uniacid, ":js_openid" => $value['y_openid'], ":js_id" => $value['y_id']));
+            $pingfen = $orderpingfen[0]['pingfe'] / $orderpingfen[0]['pingfennum'];
+            if ($pingfen == '0') {
+                $value['pingfen'] = 5;
+            } else {
+                $value['pingfen'] = ceil($pingfen);
+            }
+            $value['fuwunum'] = $orderpingfen[0]['pingfennum'];
+            $value['juli'] = round(get_distance($user['lon'], $user['lat'], $value['y_jing'], $value['y_wei']) / 1000, 2);
+        }
+    }
+    // var_dump($js_list);
+    //服务列表
+    // error_reporting(E_ALL);
+    $time = date("Y-m-d H:i:s", time());
+    $fw_list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " where uniacid=:uniacid and ruzhu_endtime!=:ruzhu_endtime and ruzhu_endtime>'" . $time . "' and s_status=:s_status  {$where_s}", array(":uniacid" => $uniacid, ":ruzhu_endtime" => "已到期", "s_status" => "审核通过"));
+    if (!empty($fw_list)) {
+        foreach ($fw_list as &$value) {
+            $s_id[] = $value['s_id'];
+        }
+        $s_ids = implode(",", $s_id);
+        //查询商家对应服务
+        $fuwu = pdo_fetchall("SELECT * from " . tablename("hyb_o2o_fuwu") . " where uniacid=:uniacid and x_status=1 and x_tuijian=1 and x_shangjia in({$s_ids})", array(":uniacid" => $uniacid));
+        if (!empty($fuwu)) {
+            foreach ($fuwu as &$value2) {
+                if (strpos($value2['x_thumb'], "http") === false) {
+                    $value2['x_thumb'] = $_W['attachurl'] . $value2['x_thumb'];
+                }
+                if (empty($value2['x_label'])) {
+                    $value2['x_label'] = "";
+                }
+                //查询评论数
+                $pingfennum = pdo_fetchcolumn("SELECT count(*)  FROM " . tablename('hyb_o2o_fuwupingjia') . "where uniacid=:uniacid and p_sid=:p_sid", array(":uniacid" => $uniacid, ":p_sid" => $value2['x_id']));
+                $value2['pinlunshu'] = $pingfennum;
+                //是否有优惠券优惠
+                if ($value2['x_youhuiquanstatus'] == '1') {
+                    //查询优惠券是否存在
+                    $fwyhq = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_youhuiquan") . " WHERE uniacid=:uniacid and y_id=:y_id", array(":uniacid" => $uniacid, ":y_id" => $value2['x_youhuiquan']));
+                    if (empty($fwyhq)) {
+                        $value2['yhq_type'] = "false";
+                    } else {
+                        $value2['yhq_type'] = "true";
+                        $value2['yhq_money'] = number_format($fwyhq['y_money'], 2);
+                    }
+                } else {
+                    $value2['yhq_type'] = "false";
+                }
+                //查询用户
+                $morenzhekou = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_huiyuanset") . " WHERE uniacid=:uniacid", array(":uniacid" => $uniacid));
+                // var_dump($morenzhekou);
+                if ($user['u_type'] == '0') {
+                    $x_hyjiage = $value2['x_jiage'] * $morenzhekou['hmrzk'];
+                } else {
+                    if ($user['u_typeendtime'] > $time) {
+                        $zhekou = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_huiyuan") . " WHERE uniacid=:uniacid and h_id=:h_id", array(":uniacid" => $uniacid, ":h_id" => $user['u_type']));
+                        if ($zhekou['h_zhekou'] > 1) {
+                            $x_hyjiage = $value2['x_jiage'] * $zhekou['h_zhekou'] * 0.1;
+                        } else {
+                            $x_hyjiage = $value2['x_jiage'] * $zhekou['h_zhekou'];
+                        }
+                    } else {
+                        $x_hyjiage = $value2['x_jiage'] * $morenzhekou['hmrzk'];
+                    }
+                }
+                $value2['x_hyjiage'] = number_format($x_hyjiage, 2);
+                // $value2['x_hyjiage'] = $x_hyjiage ;
+            }
+        } else {
+            $fw_list = [];
+        }
+    } else {
+        $fw_list = [];
+    }
+    // var_dump($fuwu);
+    //公告
+    $gonggao_list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_gonggao") . " where uniacid=:uniacid", array(":uniacid" => $uniacid));
+    //商品
+    $citys = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_city") . " where uniacid=:uniacid and name=:name", array(":uniacid" => $uniacid, ":name" => $city));
+    if ($city == '全国') {
+        $goods_list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_goods") . " where uniacid=:uniacid  and g_status=1 and g_tuijian=1 and (g_stock>0 and g_guige=0 or g_guige=1) order by g_ids desc", array(":uniacid" => $uniacid));
+    } else {
+        //查询商品
+        // $goods_list = pdo_fetchall("SELECT * FROM ".tablename("hyb_o2o_goods")." where uniacid=:uniacid and g_city=:g_city and g_status=1 and g_tuijian=1 and g_stock order by g_ids desc",array(":uniacid"=>$uniacid,"g_city"=>$citys['id']));
+        $goods_list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_goods") . " where uniacid=:uniacid and g_city=:g_city and g_status=1 and g_tuijian=1 and (g_stock>0 and g_guige=0 or g_guige=1) order by g_ids desc", array(":uniacid" => $uniacid, "g_city" => $citys['id']));
+    }
+    if (!empty($goods_list)) {
+        foreach ($goods_list as &$value) {
+            $value['g_thumb'] = $_W['attachurl'] . $value['g_thumb'];
+            //查询用户
+            $user = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " WHERE uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+            $morenzhekou = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_huiyuanset") . " WHERE uniacid=:uniacid", array(":uniacid" => $uniacid));
+            if ($user['u_type'] == '0') {
+                $g_hyjiage = $value['g_jiage'] * $morenzhekou['hmrzk'];
+            } else {
+                if ($user['u_typeendtime'] > $time) {
+                    $zhekou = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_huiyuan") . " WHERE uniacid=:uniacid and h_id=:h_id", array(":uniacid" => $uniacid, ":h_id" => $user['u_type']));
+                    if ($zhekou['h_zhekou'] > 1) {
+                        $g_hyjiage = $value['g_jiage'] * $zhekou['h_zhekou'] * 0.1;
+                    } else {
+                        $g_hyjiage = $value['g_jiage'] * $zhekou['h_zhekou'];
+                    }
+                } else {
+                    $g_hyjiage = $value['g_jiage'] * $morenzhekou['hmrzk'];
+                }
+            }
+            $value['g_hyjiage'] = number_format($g_hyjiage, 2);
+        }
+    }
+    //推荐服务
+    /*        $time = date("Y-m-d H:i:s",time());
+            $list = pdo_fetchall("SELECT * FROM ".tablename("hyb_o2o_shangjia")." where uniacid=:uniacid and ruzhu_endtime!=:ruzhu_endtime and ruzhu_endtime>'".$time."' and s_status=:s_status  $where_s",array(":uniacid"=>$uniacid,":ruzhu_endtime"=>"已到期","s_status"=>"审核通过"));
+            if (!empty($list)) {
+                foreach ($list as &$value) {
+                    $s_id[] = $value['s_id'];
+                }
+                $s_ids = implode(",", $s_id);  
+                //查询商家对应服务
+                $fuwu = pdo_fetchall("SELECT * from ".tablename("hyb_o2o_fuwu")." where uniacid=:uniacid and x_status=1 and x_tuijian=1 and x_shangjia in($s_ids)",array(":uniacid"=>$uniacid));
+                if (!empty($fuwu)) {
+                    foreach ($fuwu as &$value2) {
+                        if (strpos($value2['x_thumb'],"http")===false) {
+                          $value2['x_thumb'] = $_W['attachurl'].$value2['x_thumb'];
+                        }
+                      //查询评分
+                        $pingfencount = pdo_fetchall("SELECT sum(p_fenshu) as money FROM ".tablename('hyb_o2o_fuwupingjia')."where uniacid=:uniacid and p_sid=:p_sid",array(":uniacid"=>$uniacid,":p_sid"=>$value2['x_id']));
+                        $pingfennum = pdo_fetchcolumn("SELECT count(*)  FROM ".tablename('hyb_o2o_fuwupingjia')."where uniacid=:uniacid and p_sid=:p_sid",array(":uniacid"=>$uniacid,":p_sid"=>$value2['x_id']));
+                        $value2['pinlunshu'] = $pingfennum;
+                        if (empty($pingfencount[0]['money'])) {
+                            $pingfen = "0.0";
+                        }else{
+                            $pingfen = $pingfencount[0]['money']/$pingfennum;
+                        }
+                        
+                        $value2['pingfen'] =sprintf('%.1f',$pingfen);
+    
+    
+                        //查询下单数
+                        $xiadancount = pdo_fetchcolumn("SELECT count(*)  FROM ".tablename('hyb_o2o_orderfuwu')."where uniacid=:uniacid and o_xid=:o_xid",array(":uniacid"=>$uniacid,":o_xid"=>$value2['x_id']));
+                        $value2['xiadancount'] = $xiadancount;
+    
+    
+                        //查询商家经纬度
+                        $sj = pdo_fetch("SELECT * FROM ".tablename("hyb_o2o_shangjia")." WHERE uniacid=:uniacid and s_id=:s_id",array(":uniacid"=>$uniacid,":s_id"=>$value2['x_shangjia']));
+                        $value2['s_jing'] = $sj['jing'];
+                        $value2['s_wei'] = $sj['wei'];
+                        $value2['s_address'] = $sj['s_xxaddress'];
+                        if (strpos($sj['s_thumb'],"http")===false) {
+                          $value2['s_thumb'] = $_W['attachurl'].$sj['s_thumb'];
+                        }else{
+                            $value2['s_thumb'] = $sj['s_thumb'];
+                        }
+                        $value2['s_name'] = $sj['s_name'];
+                    } 
+                }else{
+                    $fuwu = [];
+                }
+                
+            }else{
+                $fuwu = [];
+            }*/
+}
+if ($op == 'weizhi') {
+    $base = pdo_fetch("SELECT baidukey FROM " . tablename("hyb_o2o_base") . " where uniacid=:uniacid", array(":uniacid" => $uniacid));
+    $_GPC['jing'];
+    $_GPC['wei'];
+    $body = file_get_contents("https://api.map.baidu.com/geocoder/v2/?ak={$base['baidukey']}&location={$_GPC['wei']},{$_GPC['jing']}&output=json");
+    $body = json_decode($body, true);
+    // $_COOKIE['city'] = ;
+    // 更新
+    if (!empty($_GPC['jing'])) {
+        $data = array();
+        $data['lon'] = $_GPC['jing'];
+        $data['lat'] = $_GPC['wei'];
+        $res = pdo_update('hyb_o2o_userinfo', $data, array('u_id' => $u_id));
+        setcookie('city', $body['result']['addressComponent']['city'], time() + 3600 * 24 * 30);
+        output_data($body['result']['addressComponent']['city']);
+    }
+    setcookie('city', "全国");
+    output_data("全国");
+}
+include $this->template('index');

+ 14 - 0
server/addons/hyb_o2o/inc/mobile/jf_jl_detail.inc.php

xqd
@@ -0,0 +1,14 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$u_id = $_SESSION['u_id'];
+if ($op == 'display') {
+    $id = $_GPC['id'];
+    $order = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_jforder") . " WHERE uniacid=:uniacid and id=:id", array(":uniacid" => $uniacid, ":id" => $id));
+    $jfgoods = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_jfgoods") . " WHERE uniacid=:uniacid and id=:id", array(":uniacid" => $uniacid, ":id" => $order['j_id']));
+    $order['g_name'] = $jfgoods['name'];
+    $order['g_thumb'] = $_W['attachurl'] . $jfgoods['thumb'];
+}
+include $this->template('jf_jl_detail/jf_jl_detail');

+ 10 - 0
server/addons/hyb_o2o/inc/mobile/jf_record.inc.php

xqd
@@ -0,0 +1,10 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+if ($op == 'display') {
+}
+if ($op == 'reg') {
+}
+include $this->template('jf_record/jf_record');

+ 10 - 0
server/addons/hyb_o2o/inc/mobile/jfsp.inc.php

xqd
@@ -0,0 +1,10 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+if ($op == 'display') {
+}
+if ($op == 'reg') {
+}
+include $this->template('jfsp/jfsp');

+ 18 - 0
server/addons/hyb_o2o/inc/mobile/jifen_list.inc.php

xqd
@@ -0,0 +1,18 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+if ($op == 'display') {
+    $id = $_REQUEST['id'];
+    $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_jfgoods") . " where uniacid=:uniacid and type=:type and status=1", array(":uniacid" => $uniacid, ":type" => $id));
+    if (!empty($list)) {
+        foreach ($list as &$value1) {
+            $value1['thumb'] = $_W['attachurl'] . $value1['thumb'];
+        }
+    }
+    $type = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_jftype") . " WHERE uniacid=:uniacid and id=:id", array(":uniacid" => $uniacid, ":id" => $id));
+    $info['list'] = $list;
+    $info['typename'] = $type['name'];
+}
+include $this->template('jifen_list/jifen_list');

+ 19 - 0
server/addons/hyb_o2o/inc/mobile/jifen_record.inc.php

xqd
@@ -0,0 +1,19 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$u_id = $_SESSION['u_id'];
+if ($op == 'display') {
+    $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_jforder") . " where uniacid=:uniacid and u_id=:u_id order by time desc ", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+    if (!empty($list)) {
+        foreach ($list as &$value) {
+            $goods = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_jfgoods") . " WHERE uniacid=:uniacid and id=:id", array(":uniacid" => $uniacid, ":id" => $value['j_id']));
+            $value['g_thumb'] = $_W['attachurl'] . $goods['thumb'];
+            foreach ($value['thumbs'] as &$values) {
+                $values = $_W['attachurl'] . $values;
+            }
+        }
+    }
+}
+include $this->template('jifen_record/jifen_record');

+ 34 - 0
server/addons/hyb_o2o/inc/mobile/jifen_sc.inc.php

xqd
@@ -0,0 +1,34 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$u_id = $_SESSION['u_id'];
+if ($op == 'display') {
+    $uniacid = $_W['uniacid'];
+    $openid = $_REQUEST['openid'];
+    $jfgoods = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_jfgoods") . " where uniacid=:uniacid and status=1", array(":uniacid" => $uniacid));
+    $jfthumb = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_jfthumb") . " where uniacid=:uniacid", array(":uniacid" => $uniacid));
+    $user = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+    if (!empty($jfgoods)) {
+        foreach ($jfgoods as &$value1) {
+            $value1['thumb'] = $_W['attachurl'] . $value1['thumb'];
+        }
+    }
+    if (!empty($jfthumb)) {
+        foreach ($jfthumb as &$value2) {
+            $value2['thumb'] = $_W['attachurl'] . $value2['thumb'];
+        }
+    }
+    $jftype = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_jftype") . " WHERE uniacid=:uniacid", array(":uniacid" => $uniacid));
+    if (!empty($jftype)) {
+        foreach ($jftype as &$value) {
+            $value['thumb'] = $_W['attachurl'] . $value['thumb'];
+        }
+    }
+    $list['jfgoods'] = $jfgoods;
+    $list['jfthumb'] = $jfthumb;
+    $list['user'] = $user;
+    $list['jftype'] = $jftype;
+}
+include $this->template('jifen_sc/jifen_sc');

+ 41 - 0
server/addons/hyb_o2o/inc/mobile/jifen_sp.inc.php

xqd
@@ -0,0 +1,41 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$u_id = $_SESSION['u_id'];
+if ($op == 'display') {
+    $id = $_GPC['id'];
+    $list = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_jfgoods") . " where uniacid=:uniacid and id=:id", array(":uniacid" => $uniacid, ":id" => $id));
+    $list['thumbs'] = unserialize($list['thumbs']);
+    foreach ($list['thumbs'] as &$value) {
+        $value = $_W['attachurl'] . $value;
+    }
+    //查询成交记录
+    $order = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_jforder") . " WHERE uniacid=:uniacid and j_id=:j_id order by time desc ", array(":uniacid" => $uniacid, ":j_id" => $list['id']));
+    if (!empty($order)) {
+        foreach ($order as &$values) {
+            $user = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " WHERE uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $values['u_id']));
+            $values['userthumb'] = $user['u_thumb'];
+        }
+    }
+    $info['info'] = $list;
+    $info['order'] = $order;
+}
+if ($op == 'payjf') {
+    $jifen = $_REQUEST['jifen'] ? $_REQUEST['jifen'] : '0';
+    $data = array('uniacid' => $uniacid, 'ordersn' => date("Ymd") . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT), 'openid' => $openid, 'u_id' => $u_id, 'j_id' => $_REQUEST['j_id'], 'jifen' => $jifen, 'address' => $_REQUEST['address'], 'xxaddress' => $_REQUEST['xxaddress'], 'username' => $_REQUEST['username'], 'usertel' => $_REQUEST['usertel'], 'time' => date("Y-m-d H:i:s", time()), 'statues' => 1, "form_id" => $_REQUEST['form_id'], 'type' => "待发货");
+    $user = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+    $jifens = $user['u_jifen'] - $_REQUEST['jifen'];
+    $data1 = array('u_jifen' => $jifens);
+    if ($jifens < 0) {
+        output_error("兑换失败,积分不足");
+    }
+    $upde = pdo_update("hyb_o2o_userinfo", $data1, array("u_id" => $u_id));
+    $res = pdo_insert("hyb_o2o_jforder", $data);
+    $id = pdo_insertid();
+    $data_moban = array("first" => array("value" => '积分兑换成功', "color" => "#4a4a4a"), "keyword1" => array("value" => json_decode($user['u_name']), "color" => "#9b9b9b"), "keyword2" => array("value" => date('Y-m-d H:i:s', time()), "color" => "#9b9b9b"), "keyword3" => array("value" => $_REQUEST['jifen'], "color" => "#9b9b9b"), "Remark" => array("value" => '点击查看详情', "color" => "#9b9b9b"));
+    $r = $this->sendTemplate($user['w_openid'], 'jfdh_wx', $data_moban, $url = $_W['siteroot'] . 'app/' . $this->createMobileUrl('jifen_record'));
+    output_data("兑换成功");
+}
+include $this->template('jifen_sp/jifen_sp');

+ 236 - 0
server/addons/hyb_o2o/inc/mobile/login.inc.php

xqd
@@ -0,0 +1,236 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+// $_SESSION['u_id'] = 543;die; 579
+// echo $_SESSION['w_openid'];
+//m('user');
+if ($op == 'testa') {
+    $_SESSION['u_id'] = $_GPC['u_id'];
+    die;
+}
+if ($op == 'sendyzg') {
+    $code = $_SESSION['yzg'] = rand('100000', '999999');
+    require_once IA_ROOT . '/addons/hyb_o2o/inc/func/SignatureHelper.php';
+    $params = array();
+    $aliduanxin = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_news") . " WHERE uniacid=:uniacid ", array("uniacid" => $uniacid));
+    $accessKeyId = $aliduanxin['accessKeyId'];
+    $accessKeySecret = $aliduanxin['accessKeySecret'];
+    $params["PhoneNumbers"] = $_GPC['u_phone'];
+    //接收人手机号
+    $params["SignName"] = $aliduanxin['SignName'];
+    $params["TemplateCode"] = $aliduanxin['yzm'];
+    $params['TemplateParam'] = array('code' => $code, "product" => "sms");
+    if (!empty($params["TemplateParam"]) && is_array($params["TemplateParam"])) {
+        $params["TemplateParam"] = json_encode($params["TemplateParam"]);
+    }
+    $helper = new SignatureHelper();
+    $content = $helper->request($accessKeyId, $accessKeySecret, "dysmsapi.aliyuncs.com", array_merge($params, array("RegionId" => "cn-hangzhou", "Action" => "SendSms", "Version" => "2017-05-25")));
+    output_data('发送成功');
+}
+//注册登录绑定 openid
+if ($op == 'reg') {
+    // echo $_SESSION['yzg'];
+    // output_error('手机号码格式错误');
+    $search = '/^1[3-9]\\d{9}$/';
+    if (!preg_match($search, trim($_GPC['u_phone']))) {
+        output_error('手机号码格式错误');
+    }
+    $user_info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " where uniacid=:uniacid and u_phone=:u_phone ", array(":uniacid" => $uniacid, ":u_phone" => $_GPC['u_phone']));
+    if ($_GPC['yzg'] != $_SESSION['yzg'] || $_SESSION['yzg'] == "") {
+        output_error('验证码错误');
+    }
+    if (!empty($user_info)) {
+        // output_error('该手机号已被绑定');
+        //获取到刚才授权到的信息
+        $user_wx_info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " where uniacid=:uniacid and w_openid=:w_openid ", array(":uniacid" => $uniacid, ":w_openid" => $_SESSION['w_openid']));
+        //删除 w_openid 用户
+        pdo_delete("hyb_o2o_userinfo", array("w_openid" => $_SESSION['w_openid']));
+        //把w_openid用户信息更新到被绑手机号
+        $data = array();
+        $data['w_openid'] = $user_wx_info['w_openid'];
+        $data['unionid'] = $user_wx_info['unionid'];
+        $data['u_name'] = $user_wx_info['u_name'];
+        $data['u_thumb'] = $user_wx_info['u_thumb'];
+        $data['u_tel_type'] = "1";
+        pdo_update("hyb_o2o_userinfo", $data, array("u_id" => $user_info['u_id']));
+        //重新生成登录信息
+        $_SESSION['u_id'] = $user_info['u_id'];
+        $_SESSION['u_phone'] = $user_info['u_phone'];
+        //添加分销商start
+        if (!empty($_SESSION['f_parentid'])) {
+            $f_parentid = $_SESSION['f_parentid'];
+            $u_id = $_SESSION['u_id'];
+            //查询父级
+            $parentid = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userfenxiao") . " where uniacid=:uniacid and f_id=:f_id", array(":uniacid" => $uniacid, ":f_id" => $f_parentid));
+            $data = array("uniacid" => $uniacid, "u_id" => $u_id, "f_name" => $f_name, "f_parentid" => $f_parentid, "f_style" => "待审核", "f_time" => date("Y-m-d H:i:s", time()), "f_type" => "0");
+            if (!empty($parentid)) {
+                //查询openid
+                $user = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userfenxiao") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+                if (empty($user) && $parentid['u_id'] != $u_id) {
+                    pdo_insert("hyb_o2o_userfenxiao", $data);
+                }
+            }
+        }
+        //end
+        output_data('手机号绑定成功');
+    }
+    $data = array(
+        "uniacid" => $uniacid,
+        "w_openid" => $_SESSION['w_openid'],
+        "u_type" => 0,
+        // "u_pass"=>$u_pass,
+        "u_phone" => $_GPC['u_phone'],
+    );
+    if ($_SESSION['w_openid'] == "") {
+        output_error('请先微信授权登录');
+    }
+    //$res = pdo_insert("hyb_o2o_userinfo",$data);
+    pdo_update("hyb_o2o_userinfo", $data, array("w_openid" => $_SESSION['w_openid']));
+    output_data('注册成功');
+}
+if ($op == 'display') {
+    /*		if(!empty($_SESSION['w_openid'])){//判断防止多次重复微信授权。
+    			$user_infos = pdo_fetch("SELECT * FROM ".tablename("hyb_o2o_userinfo")." where uniacid=:uniacid and w_openid=:w_openid ",array(":uniacid"=>$uniacid,":w_openid"=>$_SESSION['w_openid']));
+    
+    			if(!empty($user_infos)){//判断session 是否有效。针对数据库删除用户,浏览器还存在登录状态情况
+    				if($_SESSION['u_phone']==''){
+    					header("location:".$_W['siteroot'].$this->createMobileUrl('login'));	
+    				}else{
+    					header("location:".$_W['siteroot'].$this->createMobileUrl('mine'));		
+    				}
+    			}else{
+    					// header("location:".$_W['siteroot'].$this->createMobileUrl('login',array('op'=>'weixin')));
+    			}
+    		}*/
+    // $_SESSION['w_openid']=123;
+    // $_SESSION['yzg'] =123456;
+}
+if ($op == 'weixin') {
+    if (!empty($_SESSION['w_openid'])) {
+        //判断防止多次重复微信授权。
+        $user_infos = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " where uniacid=:uniacid and w_openid=:w_openid ", array(":uniacid" => $uniacid, ":w_openid" => $_SESSION['w_openid']));
+        if (!empty($user_infos)) {
+            //判断session 是否有效。针对数据库删除用户,浏览器还存在登录状态情况
+            if ($_SESSION['u_phone'] == '') {
+                header("location:" . $_W['siteroot'] . $this->createMobileUrl('login'));
+            } else {
+                header("location:" . $_W['siteroot'] . $this->createMobileUrl('index'));
+            }
+        }
+    }
+    require_once IA_ROOT . "/addons/hyb_o2o/inc/lib/WxPay.Config.php";
+    $config = new WxPayConfig();
+    //处理微信回调
+    $mchid = $config->GetMerchantId();
+    $appid = $config->GetAppId();
+    $apiKey = $config->GetKey();
+    $secret = $config->GetAppSecret();
+    // $redirect_uri = urlencode("https://webstrongtech.com/app/index.php?i=9&c=entry&do=login&m=hyb_o2o&op=weixin");
+    $redirect_uri = urlencode($_W['siteroot'] . $this->createMobileUrl('login', array('op' => 'weixin')));
+    $snsapi = 'snsapi_userinfo';
+    $code = isset($_GET['code']) ? $_GET['code'] : '';
+    if (!$code) {
+        $url = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
+        $oauth_url = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' . $appid . '&redirect_uri=' . urlencode($url) . '&response_type=code&scope=' . $snsapi . '&state=wxbase#wechat_redirect';
+        header('Location: ' . $oauth_url);
+        exit;
+    }
+    load()->func('communication');
+    $getOauthAccessToken = ihttp_get('https://api.weixin.qq.com/sns/oauth2/access_token?appid=' . $appid . '&secret=' . $secret . '&code=' . $code . '&grant_type=authorization_code');
+    $json = json_decode($getOauthAccessToken['content'], true);
+    if (!empty($json['errcode']) && ($json['errcode'] == '40029' || $json['errcode'] == '40163')) {
+        $url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . (strpos($_SERVER['REQUEST_URI'], '?') ? '' : '?');
+        $parse = parse_url($url);
+        if (isset($parse['query'])) {
+            parse_str($parse['query'], $params);
+            unset($params['code']);
+            unset($params['state']);
+            $url = 'http://' . $_SERVER['HTTP_HOST'] . $parse['path'] . '?' . http_build_query($params);
+        }
+        $oauth_url = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' . $appid . '&redirect_uri=' . urlencode($url) . '&response_type=code&scope=' . $snsapi . '&state=wxbase#wechat_redirect';
+        header('Location: ' . $oauth_url);
+        exit;
+    }
+    if ($snsapi == "snsapi_userinfo") {
+        $userinfo = ihttp_get('https://api.weixin.qq.com/sns/userinfo?access_token=' . $json['access_token'] . '&openid=' . $json['openid'] . '&lang=zh_CN');
+        $userinfo = $userinfo['content'];
+    } elseif ($snsapi == "snsapi_base") {
+        $userinfo = array();
+        $userinfo['openid'] = $json['openid'];
+    }
+    $userinfostr = json_decode($userinfo, true);
+    $data = array();
+    $data['uniacid'] = $uniacid;
+    $data['w_openid'] = $userinfostr['openid'];
+    $data['unionid'] = $userinfostr['unionid'];
+    $data['u_name'] = json_encode($userinfostr['nickname']);
+    $data['u_thumb'] = $userinfostr['headimgurl'];
+    $user_info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " where uniacid=:uniacid and unionid=:unionid or w_openid=:w_openid", array(":uniacid" => $uniacid, ":unionid" => $data['unionid'], ":w_openid" => $data['w_openid']));
+    // var_dump($userinfostr);die;
+    $_SESSION['w_openid'] = $data['w_openid'];
+    if (empty($user_info)) {
+        //注册
+        $res = pdo_insert("hyb_o2o_userinfo", $data);
+        $u_id = pdo_insertid();
+        $user_info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " where uniacid=:uniacid and u_id=:u_id ", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+        $_SESSION['u_id'] = $user_info['u_id'];
+        $_SESSION['u_phone'] = $user_info['u_phone'];
+    } else {
+        //登录
+        $_SESSION['u_id'] = $user_info['u_id'];
+        $_SESSION['u_phone'] = $user_info['u_phone'];
+        //更新 微信openid
+        pdo_update("hyb_o2o_userinfo", $data, array("u_id" => $user_info['u_id']));
+    }
+    if (empty($user_info['u_phone'])) {
+        header("location:" . $_W['siteroot'] . $this->createMobileUrl('login'));
+    } else {
+        header("location:" . $_W['siteroot'] . $this->createMobileUrl('index'));
+    }
+    die;
+}
+if ($op == 'app') {
+    include $this->template('login/login');
+    die;
+}
+if ($op == 'login_app') {
+    $data = $_GPC['data'];
+    // $json =json_decode($data,true);
+    if (empty($_GPC['access_token'])) {
+        output_error('授权获取失败');
+    }
+    $userinfo = ihttp_get('https://api.weixin.qq.com/sns/userinfo?access_token=' . $_GPC['access_token'] . '&openid=' . $_GPC['openid'] . '&lang=zh_CN');
+    $userinfo = $userinfo['content'];
+    $userinfostr = json_decode($userinfo, true);
+    $data = array();
+    $data['uniacid'] = $uniacid;
+    $data['app_openid'] = $userinfostr['openid'];
+    $data['unionid'] = $userinfostr['unionid'];
+    $data['u_name'] = json_encode($userinfostr['nickname']);
+    $data['u_thumb'] = $userinfostr['headimgurl'];
+    $user_info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " where uniacid=:uniacid and unionid=:unionid ", array(":uniacid" => $uniacid, ":unionid" => $data['unionid']));
+    // var_dump($userinfostr);die;
+    $_SESSION['w_openid'] = $data['w_openid'];
+    if (empty($user_info)) {
+        //注册
+        $res = pdo_insert("hyb_o2o_userinfo", $data);
+        $u_id = pdo_insertid();
+        $user_info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " where uniacid=:uniacid and u_id=:u_id ", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+        $_SESSION['u_id'] = $user_info['u_id'];
+        $_SESSION['u_phone'] = $user_info['u_phone'];
+    } else {
+        //登录
+        $_SESSION['u_id'] = $user_info['u_id'];
+        $_SESSION['u_phone'] = $user_info['u_phone'];
+        //更新 微信openid
+        pdo_update("hyb_o2o_userinfo", $data, array("u_id" => $user_info['u_id']));
+    }
+    if (empty($user_info['u_phone'])) {
+        output_data($_W['siteroot'] . $this->createMobileUrl('login'));
+    } else {
+        output_data($_W['siteroot'] . $this->createMobileUrl('index'));
+    }
+}
+include $this->template('login/login');

+ 9 - 0
server/addons/hyb_o2o/inc/mobile/login.php

xqd
@@ -0,0 +1,9 @@
+<?php
+
+global $_GPC, $_W;
+$uniacid = $_W['uniacid'];
+//m('user');
+if ($op == 'login') {
+}
+echo 11111;
+exit;

+ 382 - 0
server/addons/hyb_o2o/inc/mobile/mddd.inc.php

xqd
@@ -0,0 +1,382 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$_REQUEST['current'] = !empty($_REQUEST['current']) ? $_REQUEST['current'] : "0";
+$uniacid = $_W['uniacid'];
+$u_id = $_SESSION['u_id'];
+// error_reporting(E_ALL);
+if ($op == 'display') {
+    //查询商家抢单大厅 doPageDpqdlist()
+    $openid = $_REQUEST['openid'];
+    $city = $_REQUEST['city'] = $_COOKIE['city'];
+    $current = $_REQUEST['current'];
+    $fenlei = $_REQUEST['fenlei'];
+    $quyu = $_REQUEST['quyu'];
+    $jiage = $_REQUEST['jiage'];
+    if ($city == '全国' || $city == '') {
+        $diqu_list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_city") . " where uniacid=:uniacid and parentid=0", array(":uniacid" => $uniacid));
+    } else {
+        $diqu_info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_city") . " where uniacid=:uniacid and name=:name and parentid=0", array(":uniacid" => $uniacid, ":name" => $city));
+        $diqu_list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_city") . " where uniacid=:uniacid and parentid=:parentid", array(":uniacid" => $uniacid, ":parentid" => $diqu_info['id']));
+    }
+    if ($current == '0') {
+        if (empty($fenlei) && empty($quyu) && empty($jiage)) {
+            $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_qiangdan") . " as q left join " . tablename("hyb_o2o_fadan") . " as f on q.q_dname=f.fa_id  WHERE q.uniacid=:uniacid and q.u_id=:u_id and q.q_types in ('商家','门店') and q.q_styles=:q_styles and f.fa_fwaddress like '%{$city}%' ", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":q_styles" => "未指派"));
+            // var_dump($list);die;
+        }
+        if (!empty($fenlei) && empty($quyu) && empty($jiage)) {
+            $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_qiangdan") . " as q left join " . tablename("hyb_o2o_fadan") . " as f on q.q_dname=f.fa_id WHERE q.uniacid=:uniacid and q.u_id=:u_id and q.q_types in ('商家','门店') and q.q_styles=:q_styles and f.fa_fwstyle1=:fa_fwstyle1 and f.fa_fwaddress like '%{$city}%' ", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":q_styles" => "未指派", ":fa_fwstyle1" => $fenlei));
+        }
+        if (!empty($quyu) && empty($fenlei) && empty($jiage)) {
+            $sheng = $city . "" . $quyu;
+            $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_qiangdan") . " as q left join " . tablename("hyb_o2o_fadan") . " as f on q.q_dname=f.fa_id WHERE q.uniacid=:uniacid and q.u_id=:u_id and q.q_types in ('商家','门店') and q.q_styles=:q_styles and f.fa_fwaddress like '%{$sheng}%' ", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":q_styles" => "未指派"));
+        }
+        if (!empty($jiage) && empty($fenlei) && empty($quyu)) {
+            if ($jiage == "由高到低") {
+                $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_qiangdan") . " as q left join " . tablename("hyb_o2o_fadan") . " as f on q.q_dname=f.fa_id WHERE q.uniacid=:uniacid and q.u_id=:u_id and q.q_types in ('商家','门店') and q.q_styles=:q_styles and f.fa_fwaddress like '%{$city}%' order by f.fa_fwmoney desc", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":q_styles" => "未指派"));
+            } else {
+                if ($jiage == "由低到高") {
+                    $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_qiangdan") . " as q left join " . tablename("hyb_o2o_fadan") . " as f on q.q_dname=f.fa_id WHERE q.uniacid=:uniacid and q.u_id=:u_id and q.q_types in ('商家','门店') and q.q_styles=:q_styles and f.fa_fwaddress like '%{$city}%' order by f.fa_fwmoney asc", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":q_styles" => "未指派"));
+                } else {
+                    if ($jiage == "最新发布") {
+                        $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_qiangdan") . " as q left join " . tablename("hyb_o2o_fadan") . " as f on q.q_dname=f.fa_id WHERE q.uniacid=:uniacid and q.u_id=:u_id and q.q_types in ('商家','门店') and q.q_styles=:q_styles and f.fa_fwaddress like '%{$city}%' order by f.fa_time desc", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":q_styles" => "未指派"));
+                    }
+                }
+            }
+        }
+        if (!empty($fenlei) && !empty($quyu) && empty($jiage)) {
+            $sheng = $city . "" . $quyu;
+            $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_qiangdan") . " as q left join " . tablename("hyb_o2o_fadan") . " as f on q.q_dname=f.fa_id WHERE q.uniacid=:uniacid and q.u_id=:u_id and q.q_types in ('商家','门店') and q.q_styles=:q_styles and f.fa_fwstyle1=:fa_fwstyle1 and f.fa_fwaddress like '%{$sheng}%' ", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":q_styles" => "未指派", ":fa_fwstyle1" => $fenlei));
+        }
+        if (!empty($fenlei) && !empty($jiage) && empty($quyu)) {
+            if ($jiage == "由高到低") {
+                $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_qiangdan") . " as q left join " . tablename("hyb_o2o_fadan") . " as f on q.q_dname=f.fa_id WHERE q.uniacid=:uniacid and q.u_id=:u_id and q.q_types in ('商家','门店') and q.q_styles=:q_styles and f.fa_fwstyle1=:fa_fwstyle1  and f.fa_fwaddress like '%{$city}%'  order by f.fa_fwmoney desc", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":q_styles" => "未指派", ":fa_fwstyle1" => $fenlei));
+            } else {
+                if ($jiage == "由低到高") {
+                    $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_qiangdan") . " as q left join " . tablename("hyb_o2o_fadan") . " as f on q.q_dname=f.fa_id WHERE q.uniacid=:uniacid and q.u_id=:u_id and q.q_types in ('商家','门店') and q.q_styles=:q_styles and f.fa_fwstyle1=:fa_fwstyle1  and f.fa_fwaddress like '%{$city}%'  order by f.fa_fwmoney asc", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":q_styles" => "未指派", ":fa_fwstyle1" => $fenlei));
+                } else {
+                    if ($jiage == "最新发布") {
+                        $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_qiangdan") . " as q left join " . tablename("hyb_o2o_fadan") . " as f on q.q_dname=f.fa_id WHERE q.uniacid=:uniacid and q.u_id=:u_id and q.q_types in ('商家','门店') and q.q_styles=:q_styles and f.fa_fwstyle1=:fa_fwstyle1  and f.fa_fwaddress like '%{$city}%' order by f.fa_time desc", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":q_styles" => "未指派", "fa_fwstyle1" => $fenlei));
+                    }
+                }
+            }
+        }
+        if (!empty($quyu) && !empty($jiage) && empty($fenlei)) {
+            $sheng = $city . "" . $quyu;
+            if ($jiage == "由高到低") {
+                $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_qiangdan") . " as q left join " . tablename("hyb_o2o_fadan") . " as f on q.q_dname=f.fa_id WHERE q.uniacid=:uniacid and q.u_id=:u_id and q.q_types in ('商家','门店') and q.q_styles=:q_styles and f.fa_fwaddress like '%{$sheng}%' order by f.fa_fwmoney desc", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":q_styles" => "未指派"));
+            } else {
+                if ($jiage == "由低到高") {
+                    $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_qiangdan") . " as q left join " . tablename("hyb_o2o_fadan") . " as f on q.q_dname=f.fa_id WHERE q.uniacid=:uniacid and q.u_id=:u_id and q.q_types in ('商家','门店') and q.q_styles=:q_styles and f.fa_fwaddress like '%{$sheng}%' order by f.fa_fwmoney asc", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":q_styles" => "未指派"));
+                } else {
+                    if ($jiage == "最新发布") {
+                        $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_qiangdan") . " as q left join " . tablename("hyb_o2o_fadan") . " as f on q.q_dname=f.fa_id WHERE q.uniacid=:uniacid and q.u_id=:u_id and q.q_types in ('商家','门店') and q.q_styles=:q_styles and f.fa_fwaddress like '%{$sheng}%' order by f.fa_time desc", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":q_styles" => "未指派"));
+                    }
+                }
+            }
+        }
+        if (!empty($fenlei) && !empty($jiage) && !empty($quyu)) {
+            $sheng = $city . "" . $quyu;
+            if ($jiage == "由高到低") {
+                $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_qiangdan") . " as q left join " . tablename("hyb_o2o_fadan") . " as f on q.q_dname=f.fa_id WHERE q.uniacid=:uniacid and q.u_id=:u_id and q.q_types in ('商家','门店') and q.q_styles=:q_styles and f.fa_fwstyle1=:fa_fwstyle1 and f.fa_fwaddress like '%{$sheng}%'  order by f.fa_fwmoney desc", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":q_styles" => "未指派", ":fa_fwstyle1" => $fenlei));
+            } else {
+                if ($jiage == "由低到高") {
+                    $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_qiangdan") . " as q left join " . tablename("hyb_o2o_fadan") . " as f on q.q_dname=f.fa_id WHERE q.uniacid=:uniacid and q.u_id=:u_id and q.q_types in ('商家','门店') and q.q_styles=:q_styles and f.fa_fwstyle1=:fa_fwstyle1 and f.fa_fwaddress like '%{$sheng}%'  order by f.fa_fwmoney asc", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":q_styles" => "未指派", ":fa_fwstyle1" => $fenlei));
+                } else {
+                    if ($jiage == "最新发布") {
+                        $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_qiangdan") . " as q left join " . tablename("hyb_o2o_fadan") . " as f on q.q_dname=f.fa_id WHERE q.uniacid=:uniacid and q.u_id=:u_id and q.q_types in ('商家','门店') and q.q_styles=:q_styles and f.fa_fwstyle1=:fa_fwstyle1 and f.fa_fwaddress like '%{$sheng}%'  order by f.fa_time desc", array(":uniacid" => $uniacid, ":u_id" => $u_id, ":q_styles" => "未指派", ":fa_fwstyle1" => $fenlei));
+                    }
+                }
+            }
+        }
+    } else {
+        if ($current == '1') {
+            $list = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_qiangdan") . " as q left join " . tablename("hyb_o2o_fadan") . " as f on q.q_dname=f.fa_id WHERE q.uniacid=:uniacid and q.u_id=:u_id and q.q_types in ('商家','门店') and q.q_styles in('已派单','服务中','已完成') and f.fa_fwaddress like '%{$city}%' order by q_id desc", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+        }
+    }
+    if (!empty($list)) {
+        foreach ($list as &$value) {
+            $value['fa_fwimgpath'] = unserialize($value['fa_fwimgpath']);
+            if (!empty($value['q_pdname'])) {
+                //查询接单者
+                $yuangong = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_yuangong") . " as y left join" . tablename("hyb_o2o_userinfo") . " as u on y.u_id=u.u_id WHERE y.uniacid=:uniacid and y.y_id=:y_id", array(":uniacid" => $uniacid, ":y_id" => $value['q_pdname']));
+                if (strpos($yuangong['u_thumb'], "http") === false) {
+                    $yuangong['u_thumb'] = $_W['attachurl'] . $yuangong['u_thumb'];
+                }
+                $value['jiedan'] = $yuangong;
+            } else {
+                //查询接单者
+                $sj = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " WHERE uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $value['u_id']));
+                if (strpos($sj['s_thumb'], "http") === false) {
+                    $sj['s_thumb'] = $_W['attachurl'] . $sj['s_thumb'];
+                }
+                $jiedan['u_thumb'] = $sj['s_thumb'];
+                $jiedan['y_name'] = $sj['s_name'];
+                $jiedan['y_telphone'] = $sj['s_telphone'];
+                $value['jiedan'] = $jiedan;
+            }
+        }
+    }
+    // var_dump($list);
+}
+if ($op == "paidan") {
+    //商家派单 doPagePaidan(){
+    $y_id = $_REQUEST['y_id'];
+    $fa_id = $_REQUEST['fa_id'];
+    //查询员工信息
+    $yuangong = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_yuangong") . " where uniacid=:uniacid and y_id=:y_id", array(":uniacid" => $uniacid, ":y_id" => $y_id));
+    //查询发单信息
+    $fadan = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fadan") . " where uniacid=:uniacid and fa_id=:fa_id", array(":uniacid" => $uniacid, ":fa_id" => $fa_id));
+    $data = array("uniacid" => $uniacid, "q_pdname" => $y_id, "q_pd_time" => date("Y-m-d H:i:s", time()), "q_styles" => "已派单");
+    pdo_update("hyb_o2o_qiangdan", $data, array("q_dname" => $fa_id));
+    pdo_update("hyb_o2o_yuangong", array("y_typs" => "服务中"), array("y_id" => $y_id));
+    require_once dirname(__FILE__) . '/../../inc/func/SignatureHelper.php';
+    $params = array();
+    $aliduanxin = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_news") . " WHERE uniacid=:uniacid ", array("uniacid" => $uniacid));
+    $accessKeyId = $aliduanxin['accessKeyId'];
+    $accessKeySecret = $aliduanxin['accessKeySecret'];
+    //通知用户
+    $params["PhoneNumbers"] = $fadan['fa_fwtelphone'];
+    //接收人手机号
+    $params["SignName"] = $aliduanxin['SignName'];
+    $params["TemplateCode"] = $aliduanxin['fdtzyh'];
+    $params['TemplateParam'] = array('name' => $fadan['fa_fwname'], 'time' => $fadan['fa_fwtime'], 'content' => $yuangong['y_name'], 'tel' => $yuangong['y_telphone'], "product" => "sms");
+    if (!empty($params["TemplateParam"]) && is_array($params["TemplateParam"])) {
+        $params["TemplateParam"] = json_encode($params["TemplateParam"]);
+    }
+    $helper = new SignatureHelper();
+    $content = $helper->request($accessKeyId, $accessKeySecret, "dysmsapi.aliyuncs.com", array_merge($params, array("RegionId" => "cn-hangzhou", "Action" => "SendSms", "Version" => "2017-05-25")));
+    // var_dump($params,$content);
+    //通知员工
+    $paramss["PhoneNumbers"] = $yuangong['y_telphone'];
+    //接收人手机号
+    $paramss["SignName"] = $aliduanxin['SignName'];
+    $paramss["TemplateCode"] = $aliduanxin['fdtzyg'];
+    $paramss['TemplateParam'] = array('name' => $fadan['fa_fwname'], 'time' => $fadan['fa_fwtime'], 'tel' => $fadan['fa_fwtelphone'], "product" => "sms");
+    if (!empty($paramss["TemplateParam"]) && is_array($paramss["TemplateParam"])) {
+        $paramss["TemplateParam"] = json_encode($paramss["TemplateParam"]);
+    }
+    $helper = new SignatureHelper();
+    $content = $helper->request($accessKeyId, $accessKeySecret, "dysmsapi.aliyuncs.com", array_merge($paramss, array("RegionId" => "cn-hangzhou", "Action" => "SendSms", "Version" => "2017-05-25")));
+    // var_dump($paramss,$content);
+    output_data("指派成功");
+}
+//商家服务派单
+if ($op == 'querenfw') {
+    //商家发单服务 doPageQiangdanfwsj
+    $openid = $_REQUEST['openid'];
+    $id = $_REQUEST['id'];
+    $fa_id = $_REQUEST['fa_id'];
+    $fa_fwpay_type = $_REQUEST['fa_fwpay_type'];
+    if ($fa_fwpay_type == '一口价') {
+        pdo_update("hyb_o2o_fadan", array("fa_style" => "已完成"), array("fa_id" => $fa_id));
+        $res = pdo_update("hyb_o2o_qiangdan", array("q_styles" => "服务中"), array("q_id" => $id));
+    } else {
+        $res = pdo_update("hyb_o2o_qiangdan", array("q_styles" => "已完成"), array("q_id" => $id));
+    }
+    //查询抢单
+    $qiangdan = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_qiangdan") . " as q left join " . tablename("hyb_o2o_fadan") . " as f on q.q_dname=f.fa_id where q.uniacid=:uniacid and q.q_id=:q_id", array(":uniacid" => $uniacid, ":q_id" => $id));
+    //查询商家
+    $sj = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $qiangdan['u_id']));
+    $money = $sj['s_money'] + $qiangdan['fa_fwshagneng'];
+    //增加上门费用
+    pdo_update("hyb_o2o_shangjia", array("s_money" => $money), array("s_id" => $sj['s_id']));
+    require_once dirname(__FILE__) . '/../../inc/func/SignatureHelper.php';
+    $params = array();
+    $aliduanxin = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_news") . " WHERE uniacid=:uniacid ", array("uniacid" => $uniacid));
+    $accessKeyId = $aliduanxin['accessKeyId'];
+    $accessKeySecret = $aliduanxin['accessKeySecret'];
+    $params["PhoneNumbers"] = $sj['s_telphone'];
+    //接收人手机号
+    $params["SignName"] = $aliduanxin['SignName'];
+    $params["TemplateCode"] = $aliduanxin['fdtzfwk'];
+    $params['TemplateParam'] = array('name' => $qiangdan['fa_fwname'], 'content' => $sj['s_name'], "product" => "sms");
+    if (!empty($params["TemplateParam"]) && is_array($params["TemplateParam"])) {
+        $params["TemplateParam"] = json_encode($params["TemplateParam"]);
+    }
+    $helper = new SignatureHelper();
+    $content = $helper->request($accessKeyId, $accessKeySecret, "dysmsapi.aliyuncs.com", array_merge($params, array("RegionId" => "cn-hangzhou", "Action" => "SendSms", "Version" => "2017-05-25")));
+    output_data("操作成功");
+}
+if ($op == 'querenfw_yg') {
+    //员工doPageQiangdanfw(){
+    $openid = $_REQUEST['openid'];
+    $id = $_REQUEST['id'];
+    $data = array("q_styles" => "服务中");
+    $res = pdo_update("hyb_o2o_qiangdan", $data, array("q_id" => $id));
+    //查询抢单
+    $qiangdan = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_qiangdan") . " as q left join " . tablename("hyb_o2o_fadan") . " as f on q.q_dname=f.fa_id where q.uniacid=:uniacid and q.q_id=:q_id", array(":uniacid" => $uniacid, ":q_id" => $id));
+    if ($qiangdan['q_types'] == "商家" || $qiangdan['q_types'] == "门店") {
+        //查询商家
+        $sj = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $qiangdan['u_id']));
+        //查询服务员工
+        $yuangong = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_yuangong") . " where uniacid=:uniacid and y_id=:y_id", array(":uniacid" => $uniacid, ":y_id" => $qiangdan['q_pdname']));
+        if ($sj['pingtai'] == '0') {
+            $money = $sj['s_money'] + $qiangdan['fa_fwshagneng'];
+            pdo_update("hyb_o2o_shangjia", array("s_money" => $money), array("s_id" => $sj['s_id']));
+        } else {
+            $money = $yuangong['y_money'] + $qiangdan['fa_fwshagneng'];
+            pdo_update("hyb_o2o_yuangong", array("y_money" => $money), array("y_id" => $yuangong['y_id']));
+        }
+        require_once dirname(__FILE__) . '/../../inc/func/SignatureHelper.php';
+        $params = array();
+        $aliduanxin = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_news") . " WHERE uniacid=:uniacid ", array("uniacid" => $uniacid));
+        $accessKeyId = $aliduanxin['accessKeyId'];
+        $accessKeySecret = $aliduanxin['accessKeySecret'];
+        $params["PhoneNumbers"] = $sj['s_telphone'];
+        //接收人手机号
+        $params["SignName"] = $aliduanxin['SignName'];
+        $params["TemplateCode"] = $aliduanxin['fdtzfwk'];
+        $params['TemplateParam'] = array('name' => $qiangdan['fa_fwname'], 'content' => $yuangong['y_name'], "product" => "sms");
+        if (!empty($params["TemplateParam"]) && is_array($params["TemplateParam"])) {
+            $params["TemplateParam"] = json_encode($params["TemplateParam"]);
+        }
+        $helper = new SignatureHelper();
+        $content = $helper->request($accessKeyId, $accessKeySecret, "dysmsapi.aliyuncs.com", array_merge($params, array("RegionId" => "cn-hangzhou", "Action" => "SendSms", "Version" => "2017-05-25")));
+    } else {
+        $yg = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_yuangong") . " where uniacid=:uniacid and y_id=:y_id", array(":uniacid" => $uniacid, ":y_id" => $qiangdan['q_pdname']));
+        $money = $yg['y_money'] + $qiangdan['fa_fwshagneng'];
+        pdo_update("hyb_o2o_yuangong", array("y_money" => $money), array("y_id" => $yg['y_id']));
+    }
+    output_data("操作成功");
+}
+if ($op == 'baojia_pd') {
+    //发单报价 doPagePaidanBaojia()
+    $id = $_REQUEST['id'];
+    $q_id = $_REQUEST['q_id'];
+    $money = $_REQUEST['money'];
+    //查询发单信息
+    $fadan = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fadan") . " where uniacid=:uniacid and fa_id=:fa_id", array(":uniacid" => $uniacid, ":fa_id" => $id));
+    pdo_update("hyb_o2o_fadan", array("fa_style" => "已接单", "fa_fwmoney" => $money), array("fa_id" => $id));
+    require_once dirname(__FILE__) . '/../../inc/func/SignatureHelper.php';
+    $params = array();
+    $aliduanxin = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_news") . " WHERE uniacid=:uniacid ", array("uniacid" => $uniacid));
+    $accessKeyId = $aliduanxin['accessKeyId'];
+    $accessKeySecret = $aliduanxin['accessKeySecret'];
+    $params["PhoneNumbers"] = $fadan['fa_fwtelphone'];
+    //接收人手机号
+    $params["SignName"] = $aliduanxin['SignName'];
+    $params["TemplateCode"] = $aliduanxin['baojia'];
+    /*通知用户*/
+    $params['TemplateParam'] = array('name' => $fadan['fa_ordersn'], 'conrtent' => $fadan['fa_fwname'], 'money' => $money, "product" => "sms");
+    if (!empty($params["TemplateParam"]) && is_array($params["TemplateParam"])) {
+        $params["TemplateParam"] = json_encode($params["TemplateParam"]);
+    }
+    $helper = new SignatureHelper();
+    $content = $helper->request($accessKeyId, $accessKeySecret, "dysmsapi.aliyuncs.com", array_merge($params, array("RegionId" => "cn-hangzhou", "Action" => "SendSms", "Version" => "2017-05-25")));
+    output_data('报价成功');
+}
+// 员工请求商家估价
+if ($op == 'yg_wc_sjbaojia') {
+    //派单完成 doPageQiangdanwc
+    $id = $_REQUEST['id'];
+    $data = array("q_styles" => "已完成");
+    $res = pdo_update("hyb_o2o_qiangdan", $data, array("q_id" => $id));
+    //查询抢单信息
+    $qiang = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_qiangdan") . " WHERE uniacid=:uniacid and q_id=:q_id", array(":uniacid" => $uniacid, ":q_id" => $id));
+    $fadan = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fadan") . " WHERE uniacid=:uniacid and fa_id=:fa_id", array(":uniacid" => $uniacid, ":fa_id" => $qiang['q_dname']));
+    //查询员工信息
+    $yuangong = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_yuangong") . " WHERE uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+    //查询平台商家
+    $pingtai = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " WHERE uniacid=:uniacid and pingtai=1", array(":uniacid" => $uniacid));
+    if ($fadan['fa_fwpay_type'] == "上门估价") {
+        if ($fadan['fa_fwmoney'] == '0' && $qiang['q_types'] == "员工") {
+            $money = $fadan['fa_fwshagneng'] * $yuangong['y_choucheng'];
+            //平台抽成
+            $s_money = $pingtai['s_money'] + $money;
+            pdo_update("hyb_o2o_shangjia", array("s_money" => $s_money), array("s_id" => $pingtai['s_id']));
+            $y_money = $yuangong['y_money'] + $fadan['fa_fwshagneng'] - $money;
+            pdo_update("hyb_o2o_yuangong", array("y_typs" => "空闲中", "y_money" => $y_money), array("y_id" => $yuangong['y_id']));
+        }
+        if ($fadan['fa_fwmoney'] == '0' && $qiang['q_types'] != "员工") {
+            pdo_update("hyb_o2o_yuangong", array("y_typs" => "空闲中"), array("y_id" => $yuangong['y_id']));
+            // if ($qiang['q_types']=='商家') {
+            //      //查询商家
+            //       $sj = pdo_fetch("SELECT * FROM ".tablename("hyb_o2o_shangjia")." where uniacid=:uniacid and s_u_openid=:s_u_openid",array(":uniacid"=>$uniacid,":s_u_openid"=>$qiang['q_openid']));
+            //       $s_money = $sj['s_money']+$fadan['fa_fwshagneng'];
+            //       pdo_update("hyb_o2o_shangjia",array("s_money"=>$s_money),array("s_id"=>$sj['s_id']));
+            // }
+            // if ($qiang['q_types']=="门店") {
+            //     $s_money = $pingtai['s_money']+$fadan['fa_fwshagneng'];
+            //     pdo_update("hyb_o2o_shangjia",array("s_money"=>$s_money),array("s_id"=>$pingtai['s_id']));
+            // }
+        }
+        if ($fadan['fa_fwmoney'] != '0' && $qiang['q_types'] == "员工") {
+            $money = $fadan['fa_fwmoney'] * $yuangong['y_choucheng'];
+            //平台抽成
+            $s_money = $pingtai['s_money'] + $money;
+            pdo_update("hyb_o2o_shangjia", array("s_money" => $s_money), array("s_id" => $pingtai['s_id']));
+            $y_money = $yuangong['y_money'] + $fadan['fa_fwmoney'] - $money;
+            pdo_update("hyb_o2o_yuangong", array("y_typs" => "空闲中", "y_money" => $y_money), array("y_id" => $yuangong['y_id']));
+            pdo_update("hyb_o2o_fadan", array("fa_style" => "已完成"), array("fa_id" => $fadan['fa_id']));
+        }
+        if ($fadan['fa_fwmoney'] != '0' && $qiang['q_types'] != "员工") {
+            $money = $fadan['fa_fwmoney'] * $yuangong['y_choucheng'];
+            //员工分成
+            $y_money = $yuangong['y_money'] + $money;
+            pdo_update("hyb_o2o_yuangong", array("y_typs" => "空闲中", "y_money" => $y_money), array("y_id" => $yuangong['y_id']));
+            if ($qiang['q_types'] == '商家') {
+                //查询商家
+                $sj = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $qiang['u_id']));
+                $s_money = $sj['s_money'] + $fadan['fa_fwmoney'] - $money;
+                pdo_update("hyb_o2o_shangjia", array("s_money" => $s_money), array("s_id" => $sj['s_id']));
+            }
+            if ($qiang['q_types'] == "门店") {
+                $s_money = $pingtai['s_money'] + $fadan['fa_fwmoney'] - $money;
+                pdo_update("hyb_o2o_shangjia", array("s_money" => $s_money), array("s_id" => $pingtai['s_id']));
+            }
+            pdo_update("hyb_o2o_fadan", array("fa_style" => "已完成"), array("fa_id" => $fadan['fa_id']));
+        }
+    }
+    if ($fadan['fa_fwpay_type'] == "一口价") {
+        if ($qiang['q_types'] == "员工") {
+            $money = $fadan['fa_fwmoney'] * $yuangong['y_choucheng'];
+            //平台抽成
+            $s_money = $pingtai['s_money'] + $money;
+            pdo_update("hyb_o2o_shangjia", array("s_money" => $s_money), array("s_id" => $pingtai['s_id']));
+            $y_money = $yuangong['y_money'] + $fadan['fa_fwmoney'] - $money;
+            pdo_update("hyb_o2o_yuangong", array("y_typs" => "空闲中", "y_money" => $y_money), array("y_id" => $yuangong['y_id']));
+            pdo_update("hyb_o2o_fadan", array("fa_style" => "已完成"), array("fa_id" => $fadan['fa_id']));
+        }
+        if ($qiang['q_types'] != "员工") {
+            $money = $fadan['fa_fwmoney'] * $yuangong['y_choucheng'];
+            //员工分成
+            $y_money = $yuangong['y_money'] + $money;
+            pdo_update("hyb_o2o_yuangong", array("y_typs" => "空闲中", "y_money" => $y_money), array("y_id" => $yuangong['y_id']));
+            if ($qiang['q_types'] == '商家') {
+                //查询商家
+                $sj = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $qiang['u_id']));
+                $s_money = $sj['s_money'] + $fadan['fa_fwmoney'] - $money;
+                pdo_update("hyb_o2o_shangjia", array("s_money" => $s_money), array("s_id" => $sj['s_id']));
+            }
+            if ($qiang['q_types'] == "门店") {
+                $s_money = $pingtai['s_money'] + $fadan['fa_fwmoney'] - $money;
+                pdo_update("hyb_o2o_shangjia", array("s_money" => $s_money), array("s_id" => $pingtai['s_id']));
+            }
+            pdo_update("hyb_o2o_fadan", array("fa_style" => "已完成"), array("fa_id" => $fadan['fa_id']));
+        }
+    }
+    if ($qiang['q_types'] == "商家" || $qiang['q_types'] == "门店") {
+        //查询商家
+        $sj = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $qiang['u_id']));
+        require_once dirname(__FILE__) . '/../../inc/func/SignatureHelper.php';
+        $params = array();
+        $aliduanxin = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_news") . " WHERE uniacid=:uniacid ", array("uniacid" => $uniacid));
+        $accessKeyId = $aliduanxin['accessKeyId'];
+        $accessKeySecret = $aliduanxin['accessKeySecret'];
+        /*通知用户*/
+        $params["PhoneNumbers"] = $sj['s_telphone'];
+        //接收人手机号
+        $params["SignName"] = $aliduanxin['SignName'];
+        $params["TemplateCode"] = $aliduanxin['fdtzfww'];
+        $params['TemplateParam'] = array('name' => $fadan['fa_fwname'], 'content' => $yuangong['y_name'], "product" => "sms");
+        if (!empty($params["TemplateParam"]) && is_array($params["TemplateParam"])) {
+            $params["TemplateParam"] = json_encode($params["TemplateParam"]);
+        }
+        $helper = new SignatureHelper();
+        $content = $helper->request($accessKeyId, $accessKeySecret, "dysmsapi.aliyuncs.com", array_merge($params, array("RegionId" => "cn-hangzhou", "Action" => "SendSms", "Version" => "2017-05-25")));
+    }
+    output_data('操作成功');
+}
+include $this->template('mddd/mddd');

+ 4 - 0
server/addons/hyb_o2o/inc/mobile/member_VIP.inc - ╕▒▒╛ (5).php

xqd
@@ -0,0 +1,4 @@
+
+Warning: file_get_contents(F:/20200615/13.1.75_hyb_o2o/hyb_o2o/inc/mobile/member_VIP.inc - ¨Y??¨_ (5).php): failed to open stream: No error in F:\yunlu99\ÔÆÂ·PHP½âÃÜ20190626\tools\pretty_code.php on line 0
+<?php
+

+ 79 - 0
server/addons/hyb_o2o/inc/mobile/member_vip.inc.php

xqd
@@ -0,0 +1,79 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$city = $_COOKIE['city'];
+$u_id = $_SESSION['u_id'];
+if ($op == 'display') {
+    // error_reporting(E_ALL);
+    $uniacid = $_W['uniacid'];
+    $openid = $_REQUEST['openid'];
+    $set = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_huiyuanset") . " WHERE uniacid=:uniacid", array(":uniacid" => $uniacid));
+    $set['hbjthumb'] = $_W['attachurl'] . $set['hbjthumb'];
+    $set['hthumb'] = $_W['attachurl'] . $set['hthumb'];
+    $set['hzkthumb'] = $_W['attachurl'] . $set['hzkthumb'];
+    $set['hyhqthumb'] = $_W['attachurl'] . $set['hyhqthumb'];
+    $set['htgthumb'] = $_W['attachurl'] . $set['htgthumb'];
+    //会员折扣商品
+    $zkgoods = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_goods") . " WHERE uniacid=:uniacid and g_tjtype=1 limit 3", array(":uniacid" => $uniacid));
+    if (!empty($zkgoods)) {
+        foreach ($zkgoods as &$value1) {
+            $value1['g_thumb'] = $_W['attachurl'] . $value1['g_thumb'];
+            $value1['g_hymoney'] = number_format($value1['g_jiage'] * $set['hmrzk'], 2);
+        }
+    }
+    //会员优惠券商品
+    $yhqgoods = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_goods") . " WHERE uniacid=:uniacid and g_tjtype=2 limit 3", array(":uniacid" => $uniacid));
+    if (!empty($yhqgoods)) {
+        foreach ($yhqgoods as &$value2) {
+            $value2['g_thumb'] = $_W['attachurl'] . $value2['g_thumb'];
+            $value2['g_hymoney'] = number_format($value2['g_jiage'] * $set['hmrzk'], 2);
+        }
+    }
+    $set['quanyi'] = array(array('title' => '权益一:专享折扣', 'img' => $set['hzkthumb'], 'goods' => $zkgoods), array('title' => '权益二:会员免费领券', 'img' => $set['hyhqthumb'], 'goods' => $yhqgoods), array('title' => '权益三:会员积分', 'img' => $set['htgthumb'], 'goods' => []));
+    $user = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " WHERE uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+    if ($user['u_type'] == '0') {
+        $set['banli'] = "加入";
+        $set['banli_title'] = "加入" . $set['hname'] . ",立享特权";
+    } else {
+        $set['banli'] = "续费";
+        if ($user['u_typeendtime'] > date("Y-m-d H:i:s", time())) {
+            $set['banli_title'] = "会员到期时间: " . $user['u_typeendtime'];
+        } else {
+            $set['banli_title'] = "会员已到期,请立即续费";
+        }
+    }
+    // error_reporting(E_ALL);
+    $danmu = pdo_fetchall("SELECT a.*,b.u_thumb FROM " . tablename("hyb_o2o_huiyuan_history") . " as a left join " . tablename("hyb_o2o_userinfo") . " as b on a.uid=b.u_id  WHERE a.uniacid=:uniacid order by a.time desc limit 10", array(":uniacid" => $uniacid));
+    $set['danmu'] = $danmu;
+    // var_dump($danmu);
+    /*
+    
+          if(empty($city)||$city == "全国"){
+                $goods_list = pdo_fetchall("SELECT * FROM ".tablename("hyb_o2o_goods")." where uniacid=:uniacid and g_status=1 and g_tuijian=1 order by g_ids desc  limit 3",array(":uniacid"=>$uniacid));
+                if (empty($goods_list)) {
+                  $goods_list = [];
+                }else{
+                  foreach ($goods_list as &$value) {
+                    $value['g_thumb'] = $_W['attachurl'].$value['g_thumb'];
+                  }
+                }
+          }else{
+            $citys = pdo_fetch("SELECT * FROM ".tablename("hyb_o2o_city")." where uniacid=:uniacid and name=:name  limit 3",array(":uniacid"=>$uniacid,":name"=>$city));
+            if (empty($citys)) {
+                $goods_list = [];
+            }else{
+                //查询商品
+                $goods_list = pdo_fetchall("SELECT * FROM ".tablename("hyb_o2o_goods")." where uniacid=:uniacid and g_city=:g_city and g_status=1 and g_tuijian=1 order by g_ids desc ",array(":uniacid"=>$uniacid,"g_city"=>$citys['id']));
+                if (empty($goods_list)) {
+                  $goods_list = [];
+                }else{
+                  foreach ($goods_list as &$value) {
+                    $value['g_thumb'] = $_W['attachurl'].$value['g_thumb'];
+                  }
+                }
+            }
+          }*/
+}
+include $this->template('member_VIP/member_VIP');

+ 150 - 0
server/addons/hyb_o2o/inc/mobile/mine.inc.php

xqd
@@ -0,0 +1,150 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+$u_id = $_SESSION['u_id'];
+if ($op == 'display') {
+    $info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+    if (!empty($info)) {
+        $info['u_name'] = json_decode($info['u_name']);
+        if (strpos($info['u_thumb'], "http") === false) {
+            $info['u_thumb'] = $_W['attachurl'] . $info['u_thumb'];
+        }
+        //查询分销
+        $fenxiaoset = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_fenxiao") . " where uniacid=:uniacid", array(":uniacid" => $uniacid));
+        if (empty($fenxiaoset)) {
+            $info['f_type'] = "0";
+        } else {
+            if ($fenxiaoset['is_open'] == '0') {
+                $info['f_type'] = "0";
+            } else {
+                $fenxiao = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userfenxiao") . " WHERE uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+                if (empty($fenxiao)) {
+                    $info['f_type'] = "0";
+                } else {
+                    $info['f_type'] = $fenxiao['f_type'];
+                }
+            }
+        }
+        //用户是否为商家 0:未申请成为商家  待审核:申请成为商家待审核
+        if ($info['u_shangjia'] != "0") {
+            //代表入驻
+            if ($info['u_shangjia'] != "待审核") {
+                //查询商家是否入驻到期
+                $shangjia = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+                if ($shangjia['ruzhu_endtime'] == "已到期" || $shangjia['ruzhu_endtime'] < date("Y-m-d H:i:s", time()) || $shangjia['ruzhu_endtime'] == date("Y-m-d H:i:s", time())) {
+                    $info['u_shangjiaruzhu'] = "已到期";
+                }
+            }
+        }
+        //查询用户是否为员工
+        if ($info['u_yuangong'] != "0") {
+            $yuangong = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_yuangong") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+            //查询员工所属商家是否为平台
+            $pingtai = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " where uniacid=:uniacid and pingtai=1", array(":uniacid" => $uniacid));
+            if ($pingtai['s_id'] == $yuangong['y_sjname'] && $yuangong['y_rz'] == '0') {
+                $ptyg = "false";
+                //商家员工
+            } elseif ($pingtai['s_id'] == $yuangong['y_sjname'] && $yuangong['y_rz'] == '1') {
+                $ptyg = "true";
+                //商家技师
+                if ($yuangong['y_endtime'] == "已到期" || $yuangong['y_endtime'] < date("Y-m-d H:i:s", time()) || $yuangong['y_endtime'] == date("Y-m-d H:i:s", time())) {
+                    $info['u_jsrz'] = "已到期";
+                }
+                $time = date("Y-m-d H:i:s", time());
+                $day = round((strtotime($yuangong['y_endtime']) - strtotime($time)) / 86400);
+                if ($day < 0) {
+                    $info['jsrz_endday'] = "0";
+                } else {
+                    $info['jsrz_endday'] = $day;
+                }
+            } elseif ($pingtai['s_id'] != $yuangong['y_sjname'] && $yuangong['y_rz'] == '0') {
+                $ptyg = "false";
+                //商家技师
+            }
+            $info['ptyg'] = $ptyg;
+            //查询员工接单数
+            $count1 = pdo_fetchcolumn("SELECT count(*) FROM " . tablename("hyb_o2o_qiangdan") . " WHERE uniacid=:uniacid and q_pdname=:q_pdname", array(":uniacid" => $uniacid, ":q_pdname" => $yuangong['y_id']));
+            $count2 = pdo_fetchcolumn("SELECT count(*) FROM " . tablename("hyb_o2o_qiangdan") . " WHERE uniacid=:uniacid and q_openid=:q_openid", array(":uniacid" => $uniacid, ":q_openid" => $yuangong['y_openid']));
+            $count3 = pdo_fetchcolumn("SELECT count(*) FROM " . tablename("hyb_o2o_orderfuwu") . " WHERE uniacid=:uniacid and o_fwry=:o_fwry and o_store=:o_store", array(":uniacid" => $uniacid, ":o_fwry" => $yuangong['y_name'], ":o_store" => $yuangong['y_sjname']));
+            $info['y_telphone'] = $yuangong['y_telphone'];
+            if (strpos($yuangong['y_thumb'], "http") === false) {
+                $info['y_thumb'] = $_W['attachurl'] . $yuangong['y_thumb'];
+            } else {
+                $info['y_thumb'] = $yuangong['y_thumb'];
+            }
+            if (empty($yuangong['y_choucheng'])) {
+                $yuangong['y_choucheng'] = "0";
+            }
+            $info['y_name'] = $yuangong['y_name'];
+            $info['y_typs'] = $yuangong['y_typs'];
+            $info['y_money'] = $yuangong['y_money'];
+            $info['y_jiedannum'] = $count1 + $count2 + $count3;
+            $info['y_choucheng'] = $yuangong['y_choucheng'];
+        }
+        $mendian = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_mendian") . " where uniacid=:uniacid", array(":uniacid" => $uniacid));
+        //用户是否为会员
+        if ($info['u_type'] != "0" && $info['u_typeendtime'] > date("Y-m-d H:i:s", time()) && $info['u_typeendtime'] != "已到期") {
+            $huiyuan = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_huiyuan") . " where uniacid=:uniacid and h_id=:h_id", array(":uniacid" => $uniacid, ":h_id" => $info['u_type']));
+            $info['huiyuan_name'] = $huiyuan['h_name'];
+            $info['huiyuan_thumb'] = $_W['attachurl'] . $huiyuan["h_thumb"];
+        }
+        if ($info['u_type'] == "0") {
+            $info['huiyuan_name'] = "普通用户";
+        }
+        if (empty($info['u_tel'])) {
+            $info['bangding'] = "false";
+        } else {
+            $info['bangding'] = "true";
+        }
+    }
+    $sj_tishi = 1;
+    if ($info['u_shangjia'] == '0') {
+        $sj_tishi = 2;
+        //请先入驻
+    } elseif ($info['u_shangjia'] == '未支付') {
+        $sj_tishi = 3;
+    } elseif ($info['u_shangjia'] == "待审核") {
+        $sj_tishi = 5;
+        $sj_tishi = "正在审核中";
+    } elseif ($info['u_shangjiaruzhu'] == "已到期") {
+        $sj_tishi = 4;
+        //商家入驻已到期请前往续费
+    }
+    //员工判断
+    $yg_tishi = 1;
+    if ($info['u_shangjia'] != '0' && $info['u_shangjia'] != '待审核') {
+        $yg_tishi = "您已是商家";
+    } elseif ($info['ptyg'] == "true") {
+        $yg_tishi = "您已是平台技师";
+    } elseif ($info['u_yuangong'] == "待审核") {
+        $yg_tishi = "正在审核中";
+    } elseif ($info['u_yuangong'] == 0) {
+        $yg_tishi = 2;
+    }
+    //技师判断
+    $js_tishi = 1;
+    if ($info['u_shangjia'] != '0' && $info['u_shangjia'] != '待审核') {
+        $js_tishi = "您已是商家";
+    } elseif ($info['ptyg'] == "false") {
+        $js_tishi = "您已是商家员工";
+    } elseif ($info['u_yuangong'] == "待审核") {
+        $js_tishi = "正在审核中";
+    } elseif ($info['u_jsrz'] == "已到期") {
+        $js_tishi = 3;
+    } elseif ($info['u_yuangong'] == 0) {
+        $js_tishi = 2;
+    }
+    //output_data($info);
+}
+if ($op == 'test') {
+    //订单支付通知
+    $data = array("first" => array("value" => '详细内容', "color" => "#4a4a4a"), "orderMoneySum" => array("value" => 10, "color" => "#9b9b9b"), "orderProductName" => array("value" => '商品信息', "color" => "#9b9b9b"), "Remark" => array("value" => 'aaa', "color" => "#9b9b9b"));
+    $data_moban = array("first" => array("value" => '您好,您已成功进行余额充值。', "color" => "#4a4a4a"), "keyword1" => array("value" => '嗄 ', "color" => "#9b9b9b"), "keyword2" => array("value" => 10, "color" => "#9b9b9b"), "keyword3" => array("value" => 10, "color" => "#9b9b9b"), "keyword4" => array("value" => '充值成功', "color" => "#9b9b9b"), "Remark" => array("value" => '点击查看余额等详细信息', "color" => "#9b9b9b"));
+    $user_info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " WHERE uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+    $r = $this->sendTemplate($user_info['w_openid'], 'chongzhi_wx', $data_moban, $url = $_W['siteroot'] . 'app/' . $this->createMobileUrl('refill_log'));
+    var_dump($r);
+    die;
+}
+include $this->template('mine/mine');

+ 123 - 0
server/addons/hyb_o2o/inc/mobile/mine_s.inc.php

xqd
@@ -0,0 +1,123 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+if ($op == 'display') {
+    $u_id = $_SESSION['u_id'];
+    //查询商家doPageShangjia()
+    $openid = $_REQUEST['openid'];
+    //查询商家
+    $info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+    //查询商家接单
+    $jiedan = pdo_fetchcolumn("SELECT count(*) FROM " . tablename("hyb_o2o_qiangdan") . " WHERE uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $info['u_id']));
+    $info['jiedan'] = $jiedan;
+    if (empty($info['label'])) {
+        $info['label'] = [];
+    } else {
+        $info['label'] = unserialize($info['label']);
+    }
+    if (strpos($info['s_thumb'], "http") === false) {
+        $info['s_thumb'] = $_W['attachurl'] . $info['s_thumb'];
+    }
+    if (strpos($info['s_zhizhao'], "http") === false) {
+        $info['s_zhizhao'] = $_W['attachurl'] . $info['s_zhizhao'];
+    }
+    if (strpos($info['s_idcard'], "http") === false) {
+        $info['s_idcard'] = $_W['attachurl'] . $info['s_idcard'];
+    }
+    if (strpos($info['s_idcard2'], "http") === false) {
+        $info['s_idcard2'] = $_W['attachurl'] . $info['s_idcard2'];
+    }
+    $info['s_imgpath'] = unserialize($info['s_imgpath']);
+    foreach ($info['s_imgpath'] as &$value) {
+        if (strpos($value, "http") === false) {
+            $value = $_W['attachurl'] . $value;
+        }
+    }
+    if (date("Y-m-d H:i:s", time()) === $info['ruzhu_endtime'] || date("Y-m-d H:i:s", time()) > $info['ruzhu_endtime'] || $info['ruzhu_endtime'] == "已到期") {
+        $info['daoqi'] = 1;
+    } else {
+        $info['daoqi'] = 0;
+    }
+    $time = date("Y-m-d H:i:s", time());
+    $day = round((strtotime($info['ruzhu_endtime']) - strtotime($time)) / 86400);
+    if ($day < 0) {
+        $info['day'] = "0";
+    } else {
+        $info['day'] = $day;
+    }
+    //查询用户是否为分销商
+    $fenxiaoshang = pdo_fetch('SELECT * FROM ' . tablename("hyb_o2o_userfenxiao") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+    if (!empty($fenxiaoshang)) {
+        //分销下级
+        $fenxiaxiaji = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_userfenxiao") . " WHERE uniacid=:uniacid and f_parentid=:f_parentid", array(":uniacid" => $uniacid, ":f_parentid" => $fenxiaoshang['f_id']));
+        if (!empty($fenxiaxiaji)) {
+            foreach ($fenxiaxiaji as &$value) {
+                $user = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " WHERE uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $value['u_id']));
+                if ($user['u_shangjia'] != '0' && $user['u_shangjia'] != '待审核') {
+                    $qixiashangjiaid[] = $user['u_shangjia'];
+                }
+                if ($user['u_type'] != '0' && $time < $user['u_typeendtime']) {
+                    $qixiahuiyuanid[] = $user['u_id'];
+                }
+            }
+            $qixiashangjiaid = implode(",", $qixiashangjiaid);
+            $qixiahuiyuanid = implode(",", $qixiahuiyuanid);
+            //旗下商家
+            if (empty($qixiashangjiaid)) {
+                $info['qixiashangjia'] = [];
+                $info['qixiashangjianum'] = "0";
+            } else {
+                //查询商家
+                $qixiashangjia = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " where uniacid=:uniacid and s_id in({$qixiashangjiaid})", array(":uniacid" => $uniacid));
+                foreach ($qixiashangjia as &$qxsj) {
+                    $qxfxsname = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userfenxiao") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $qxsj['u_id']));
+                    $fenxiaoyongjin = pdo_fetchall("SELECT count(*) as xfnum, sum(yongjin) as ztyj FROM " . tablename("hyb_o2o_fenxiaoyongjin") . " WHERE uniacid=:uniacid and yonghu=:yonghu and parentid=:parentid and u_id=:u_id", array(":uniacid" => $uniacid, ":yonghu" => $qxfxsname['f_name'], ":parentid" => $qxfxsname['f_id'], ":u_id" => $qxfxsname['u_id']));
+                    $qxsj['ztyj'] = $fenxiaoyongjin[0]['ztyj'];
+                    $qxsj['xfnum'] = $fenxiaoyongjin[0]['xfnum'];
+                    if (strpos($qxsj['s_thumb'], "http") === false) {
+                        $qxsj['s_thumb'] = $_W['attachurl'] . $qxsj['s_thumb'];
+                    }
+                }
+                $info['qixiashangjia'] = $qixiashangjia;
+                $info['qixiashangjianum'] = count($qixiashangjia);
+            }
+            //旗下会员
+            if (empty($qixiashangjiaid)) {
+                $info['qixiahuiyuan'] = [];
+                $info['qixiahuiyuannum'] = "0";
+            } else {
+                //查询会员
+                $qixiahuiyuan = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " where uniacid=:uniacid and u_id in({$qixiashangjiaid})", array(":uniacid" => $uniacid));
+                foreach ($qixiahuiyuan as &$qxhy) {
+                    $qxfxsname = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userfenxiao") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $qxhy['u_id']));
+                    $fenxiaoyongjin = pdo_fetchall("SELECT sum(yongjin) as ztyj FROM " . tablename("hyb_o2o_fenxiaoyongjin") . " WHERE uniacid=:uniacid and yonghu=:yonghu and parentid=:parentid and u_id=:u_id", array(":uniacid" => $uniacid, ":yonghu" => $qxfxsname['f_name'], ":parentid" => $qxfxsname['f_id'], ":u_id" => $qxfxsname['u_id']));
+                    $qxhy['ztyj'] = $fenxiaoyongjin[0]['ztyj'];
+                    $qxhy['u_name'] = json_decode($qxhy['u_name']);
+                    if (strpos($qxhy['u_thumb'], "http") === false) {
+                        $qxhy['u_thumb'] = $_W['attachurl'] . $qxhy['u_thumb'];
+                    }
+                }
+                $info['qixiahuiyuan'] = $qixiahuiyuan;
+                $info['qixiahuiyuannum'] = count($qixiahuiyuan);
+            }
+        } else {
+            $info['qixiashangjia'] = [];
+            $info['qixiahuiyuan'] = [];
+            $info['qixiashangjianum'] = "0";
+            $info['qixiahuiyuannum'] = "0";
+        }
+    } else {
+        $info['qixiashangjia'] = [];
+        $info['qixiahuiyuan'] = [];
+        $info['qixiashangjianum'] = "0";
+        $info['qixiahuiyuannum'] = "0";
+    }
+    $wxinfo = $this->getSignPackage();
+}
+if ($op == 'barcode_scan') {
+    include $this->template('mine_s/barcode_scan');
+    die;
+}
+include $this->template('mine_s/mine_s');

+ 119 - 0
server/addons/hyb_o2o/inc/mobile/mine_s_hy.inc.php

xqd
@@ -0,0 +1,119 @@
+<?php
+
+global $_GPC, $_W;
+$op = !empty($_GPC['op']) ? $_GPC['op'] : "display";
+$uniacid = $_W['uniacid'];
+if ($op == 'display') {
+    //查询商家doPageShangjia()
+    $openid = $_REQUEST['openid'];
+    //查询商家
+    $info = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+    //查询商家接单
+    $jiedan = pdo_fetchcolumn("SELECT count(*) FROM " . tablename("hyb_o2o_qiangdan") . " WHERE uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $info['u_id']));
+    $info['jiedan'] = $jiedan;
+    if (empty($info['label'])) {
+        $info['label'] = [];
+    } else {
+        $info['label'] = unserialize($info['label']);
+    }
+    if (strpos($info['s_thumb'], "http") === false) {
+        $info['s_thumb'] = $_W['attachurl'] . $info['s_thumb'];
+    }
+    if (strpos($info['s_zhizhao'], "http") === false) {
+        $info['s_zhizhao'] = $_W['attachurl'] . $info['s_zhizhao'];
+    }
+    if (strpos($info['s_idcard'], "http") === false) {
+        $info['s_idcard'] = $_W['attachurl'] . $info['s_idcard'];
+    }
+    if (strpos($info['s_idcard2'], "http") === false) {
+        $info['s_idcard2'] = $_W['attachurl'] . $info['s_idcard2'];
+    }
+    $info['s_imgpath'] = unserialize($info['s_imgpath']);
+    foreach ($info['s_imgpath'] as &$value) {
+        if (strpos($value, "http") === false) {
+            $value = $_W['attachurl'] . $value;
+        }
+    }
+    if (date("Y-m-d H:i:s", time()) === $info['ruzhu_endtime'] || date("Y-m-d H:i:s", time()) > $info['ruzhu_endtime'] || $info['ruzhu_endtime'] == "已到期") {
+        $info['daoqi'] = 1;
+    } else {
+        $info['daoqi'] = 0;
+    }
+    $time = date("Y-m-d H:i:s", time());
+    $day = round((strtotime($info['ruzhu_endtime']) - strtotime($time)) / 86400);
+    if ($day < 0) {
+        $info['day'] = "0";
+    } else {
+        $info['day'] = $day;
+    }
+    //查询用户是否为分销商
+    $fenxiaoshang = pdo_fetch('SELECT * FROM ' . tablename("hyb_o2o_userfenxiao") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $u_id));
+    if (!empty($fenxiaoshang)) {
+        //分销下级
+        $fenxiaxiaji = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_userfenxiao") . " WHERE uniacid=:uniacid and f_parentid=:f_parentid", array(":uniacid" => $uniacid, ":f_parentid" => $fenxiaoshang['f_id']));
+        if (!empty($fenxiaxiaji)) {
+            foreach ($fenxiaxiaji as &$value) {
+                $user = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " WHERE uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $value['u_id']));
+                if ($user['u_shangjia'] != '0' && $user['u_shangjia'] != '待审核') {
+                    $qixiashangjiaid[] = $user['u_shangjia'];
+                }
+                if ($user['u_type'] != '0' && $time < $user['u_typeendtime']) {
+                    $qixiahuiyuanid[] = $user['u_id'];
+                }
+            }
+            $qixiashangjiaid = implode(",", $qixiashangjiaid);
+            $qixiahuiyuanid = implode(",", $qixiahuiyuanid);
+            //旗下商家
+            if (empty($qixiashangjiaid)) {
+                $info['qixiashangjia'] = [];
+                $info['qixiashangjianum'] = "0";
+            } else {
+                //查询商家
+                $qixiashangjia = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_shangjia") . " where uniacid=:uniacid and s_id in({$qixiashangjiaid})", array(":uniacid" => $uniacid));
+                foreach ($qixiashangjia as &$qxsj) {
+                    $qxfxsname = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userfenxiao") . " where uniacid=:uniacid and u_id=:u_id", array(":uniacid" => $uniacid, ":u_id" => $qxsj['u_id']));
+                    $fenxiaoyongjin = pdo_fetchall("SELECT count(*) as xfnum, sum(yongjin) as ztyj FROM " . tablename("hyb_o2o_fenxiaoyongjin") . " WHERE uniacid=:uniacid and yonghu=:yonghu and parentid=:parentid and parentopenid=:parentopenid", array(":uniacid" => $uniacid, ":yonghu" => $qxfxsname['f_name'], ":parentid" => $qxfxsname['f_id'], ":parentopenid" => $qxfxsname['f_openid']));
+                    $qxsj['ztyj'] = $fenxiaoyongjin[0]['ztyj'];
+                    $qxsj['xfnum'] = $fenxiaoyongjin[0]['xfnum'];
+                    if (strpos($qxsj['s_thumb'], "http") === false) {
+                        $qxsj['s_thumb'] = $_W['attachurl'] . $qxsj['s_thumb'];
+                    }
+                }
+                $info['qixiashangjia'] = $qixiashangjia;
+                $info['qixiashangjianum'] = count($qixiashangjia);
+            }
+            //旗下会员
+            if (empty($qixiashangjiaid)) {
+                $info['qixiahuiyuan'] = [];
+                $info['qixiahuiyuannum'] = "0";
+            } else {
+                //查询会员
+                $qixiahuiyuan = pdo_fetchall("SELECT * FROM " . tablename("hyb_o2o_userinfo") . " where uniacid=:uniacid and u_id in({$qixiashangjiaid})", array(":uniacid" => $uniacid));
+                foreach ($qixiahuiyuan as &$qxhy) {
+                    $qxfxsname = pdo_fetch("SELECT * FROM " . tablename("hyb_o2o_userfenxiao") . " where uniacid=:uniacid and f_openid=:f_openid", array(":uniacid" => $uniacid, ":f_openid" => $qxhy['openid']));
+                    $fenxiaoyongjin = pdo_fetchall("SELECT sum(yongjin) as ztyj FROM " . tablename("hyb_o2o_fenxiaoyongjin") . " WHERE uniacid=:uniacid and yonghu=:yonghu and parentid=:parentid and parentopenid=:parentopenid", array(":uniacid" => $uniacid, ":yonghu" => $qxfxsname['f_name'], ":parentid" => $qxfxsname['f_id'], ":parentopenid" => $qxfxsname['f_openid']));
+                    $qxhy['ztyj'] = $fenxiaoyongjin[0]['ztyj'];
+                    $qxhy['u_name'] = json_decode($qxhy['u_name']);
+                    if (strpos($qxhy['u_thumb'], "http") === false) {
+                        $qxhy['u_thumb'] = $_W['attachurl'] . $qxhy['u_thumb'];
+                    }
+                }
+                $info['qixiahuiyuan'] = $qixiahuiyuan;
+                $info['qixiahuiyuannum'] = count($qixiahuiyuan);
+            }
+        } else {
+            $info['qixiashangjia'] = [];
+            $info['qixiahuiyuan'] = [];
+            $info['qixiashangjianum'] = "0";
+            $info['qixiahuiyuannum'] = "0";
+        }
+    } else {
+        $info['qixiashangjia'] = [];
+        $info['qixiahuiyuan'] = [];
+        $info['qixiashangjianum'] = "0";
+        $info['qixiahuiyuannum'] = "0";
+    }
+}
+if ($op == 'reg') {
+}
+include $this->template('mine_s_hy/mine_s_hy');

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác