IndexController.class_danfuwu.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <?php
  2. namespace Seller\Controller;
  3. use Admin\Model\StatisticsModel;
  4. class IndexController extends CommonController {
  5. protected function _initialize(){
  6. parent::_initialize();
  7. $this->breadcrumb1='首页';
  8. $this->breadcrumb2='首页';
  9. $this->type = 'mall';
  10. $this->admin_domain = 'https://mall.shiziyu888.com/dan/';
  11. $this->host = base64_encode( strtolower(strval($_SERVER['HTTP_HOST'])));
  12. }
  13. function duoduo_action($action, $version='V1.7') {
  14. $host = base64_encode( strtolower(strval($_SERVER['HTTP_HOST'])));
  15. $type = $this->type;
  16. $url = $this->admin_domain."/seller.php?s=/Upgrade/req_version/type/{$type}/version/{$version}/host/{$host}";
  17. $r = sendhttp_get($url);
  18. return json_decode($r, true);
  19. }
  20. function zuitu_upgrade($action, $version='V1.0') {
  21. $result = $this->duoduo_action($action, $version);
  22. return $result;
  23. }
  24. function duoduo_version($version) {
  25. return $this->duoduo_action('version', $version);
  26. }
  27. public function index(){
  28. $config_arr = M('config')->where( array('name' => 'VERSION') )->find();
  29. $version = $config_arr['value'];
  30. $version_meta = $this->duoduo_version($version);
  31. $isnew = true;
  32. $newsubversion = '';
  33. if(!empty($version_meta))
  34. {
  35. $isnew = false;
  36. $newsubversion = end($version_meta);
  37. $newsubversion = $newsubversion['name'];
  38. }
  39. $this->version = $version;
  40. $this->newsubversion = $newsubversion;
  41. $version_meta = array_reverse($version_meta);
  42. $this->version_meta = $version_meta;
  43. $seller_info = M('seller')->where( array('s_id' => SELLERUID) )->find();
  44. if(empty($seller_info['we_hexiao_qrcode']) || isset($_GET['reflash']))
  45. {
  46. //qrcode
  47. $jssdk = new \Lib\Weixin\Jssdk( C('weprogram_appid'), C('weprogram_appscret') );
  48. //$weqrcode = $jssdk->getAllWeQrcode('pages/store/index','5');
  49. $weqrcode = $jssdk->getAllWeQrcode('pages/order/hexiao_bind',SELLERUID.'_0' );
  50. //var_dump($weqrcode);die();
  51. //保存图片
  52. $image_dir = ROOT_PATH.'Uploads/image/goods';
  53. $image_dir .= '/'.date('Y-m-d').'/';
  54. $file_path = C('SITE_URL').'Uploads/image/goods/'.date('Y-m-d').'/';
  55. $kufile_path = $dir.'/'.date('Y-m-d').'/';
  56. RecursiveMkdir($image_dir);
  57. $file_name = md5('qrcode_'.$pick_order_info['pick_sn'].time()).'.png';
  58. //qrcode
  59. file_put_contents($image_dir.$file_name, $weqrcode);
  60. M('seller')->where( array('s_id' => SELLERUID) )->save( array('we_hexiao_qrcode' => $file_path.$file_name) );
  61. $seller_info['we_hexiao_qrcode'] = $file_path.$file_name;
  62. }
  63. $this->seller_info = $seller_info;
  64. //SELLERUID
  65. $model=new StatisticsModel();
  66. $hashids = new \Lib\Hashids(C('PWD_KEY'), C('URL_ID'));
  67. $has_seller_id = $hashids->encode(SELLERUID);
  68. $bind_order_notify_link = C('SITE_URL')."/index.php?s=/seller/bind_order_notify/seller_id/{$has_seller_id}";
  69. $this->bind_order_notify_link = $bind_order_notify_link;
  70. $unbind_order_notify_link = C('SITE_URL')."/index.php?s=/seller/unbind_order_notify/seller_id/{$has_seller_id}";
  71. $this->unbind_order_notify_link = $unbind_order_notify_link;
  72. $bind_pickup_order_link = C('SITE_URL')."/index.php?s=/seller/bind_pickup_order/seller_id/{$has_seller_id}";
  73. $this->bind_pickup_order_link = ($bind_pickup_order_link);
  74. $unbind_pickup_order_link = C('SITE_URL')."/index.php?s=/seller/unbind_pickup_order/seller_id/{$has_seller_id}";
  75. $this->unbind_pickup_order_link = ($unbind_pickup_order_link);
  76. $bloglist = M('blog')->where( array('type' => 'seller') )->order('blog_id desc')->limit(10)->select();
  77. $this->bloglist = $bloglist;
  78. $seller_view_link = C('SITE_URL')."/index.php?s=/seller/info/seller_id/".SELLERUID.".html";
  79. $this->seller_view_link = $seller_view_link;
  80. $this->total_money=$model->get_total_sales( array('store_id' => SELLERUID) );
  81. $this->today_money=$model->get_total_sales(array('date_added' => date('Y-m-d') ,'store_id' => SELLERUID));
  82. $this->total_order=$model->get_total_order( array('store_id' => SELLERUID) );
  83. $this->today_order=$model->get_total_order(array('date_added' => date('Y-m-d'), 'store_id' => SELLERUID));
  84. $order_model=new \Admin\Model\OrderModel();
  85. //store_id
  86. $data=$order_model->show_order_page( array('store_id' => SELLERUID) );
  87. $this->empty=$data['empty'];
  88. $this->list=$data['list'];
  89. $this->uc_empty='~~暂无数据';
  90. $this->uc_list=$model->get_user_action();
  91. $this->display();
  92. }
  93. }