public function indexAction()
 {
     //获取支付编号
     //取付款金额
     $payid = I('get.payid', '');
     if ($payid == '') {
         $this->assign('msg', '支付失败!');
     } else {
         $payM = new OrderRelationModel();
         $res = $payM->getPay($payid);
         $customer = new CustomerModel();
         $key = 'buy_openid';
         $customerInfo = $customer->getCustomerInfo($res[$key]);
         $this->assign('freezen_state', $customerInfo['freezen_state']);
         $pay = $res['payable'];
         $indexUrl = U('Home/Index/index');
         $wxPayUrl = U('WxPay/Pay/payNow');
         $wxPayUrl .= "?payid=" . $payid;
         $introductionM = new IntroductionModel();
         $id = 4;
         $tips = $introductionM->getInfoById($id);
         $this->assign('tips', $tips['content']);
         $openid = get_openid();
         $css = $this->fetch('indexCss');
         $js = $this->fetch('js');
         $this->assign('indexUrl', $indexUrl);
         $this->assign('wxPay', $wxPayUrl);
         $this->assign('pay', $pay);
         $this->assign('css', $css);
         $this->assign('js', $js);
         $this->assign("YZBody", $this->fetch());
         $this->display(YZ_TEMPLATE);
     }
 }
 public function indexAction()
 {
     $openid = get_openid();
     $customer = new CustomerModel();
     $customerInfo = $customer->getCustomerInfo($openid);
     $gotoUrl = U('User/UserCenter/index');
     $this->assign('gotoUrl', $gotoUrl);
     $url = U('change');
     $this->assign('changeUrl', $url);
     $this->assign(number, $customerInfo['phone_number']);
     $this->assign('account', $customerInfo['account']);
     $this->assign('openid', $openid);
     $js = $this->fetch('indexJs');
     $this->assign('js', $js);
     $css = $this->fetch('indexCss');
     $this->assign('css', $css);
     $this->assign('YZBody', $this->fetch());
     $this->display(YZ_TEMPLATE);
 }
 public function getAchievementByOpenid($openid, $beginTime, $endTime)
 {
     $map['is_payed'] = 1;
     $map['is_cancel'] = 0;
     $map['payed_time'] = array('BETWEEN', "{$beginTime},{$endTime}");
     if (is_array($openid)) {
         $customer = new CustomerModel();
         $totalDirectFee = 0;
         //直销业绩
         $totalLineFee = 0;
         //线销业绩
         $totalGoodsFee = 0;
         //商品总价(基数)
         $resArr = array();
         foreach ($openid as $k => $v) {
             $map['buy_openid'] = $v['openid'];
             $data = $this->where($map)->select();
             $res = $this->_getAchieveData($data);
             $res['_customer'] = $customer->getCustomerInfo($v['openid']);
             $res['_detail'] = $data;
             $totalDirectFee += $res['_totalDirectFee'];
             $totalLineFee += $res['_totalLineFee'];
             $totalGoodsFee += $res['_totalGoodsFee'];
             $resArr['_detail'][$v['openid']] = $res;
         }
         $resArr['_totalDirectFee'] = $totalDirectFee;
         $resArr['_totalLineFee'] = $totalLineFee;
         $resArr['_totalGoodsFee'] = $totalGoodsFee;
         return $resArr;
     } else {
         $map['buy_openid'] = $openid;
         $data = $this->where($map)->select();
         $res = $this->_getAchieveData($data);
         $res['_detail'] = $data;
         return $res;
     }
 }