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); } }
private function _addParentName($parentId) { $map['id'] = $parentId; $customer = new CustomerModel(); $parentName = $customer->where($map)->field('nickname')->find(); return $parentName; }
public function indexAction() { $id = I('get.id', ''); if ($id == '') { return false; } $customer = new CustomerModel(); $customerInfo = $customer->changeCustomerFreezenState($id); $url = $_SERVER['HTTP_REFERER']; redirect_url($url); }
public function changOkAction() { $customer = new CustomerModel(); $resData = $customer->changPhone(); $url = U('User/UserCenter/index'); if ($resData['status'] == 'success') { $this->success('修改成功', $url, 2); } else { $this->error('修改失败', $url); } }
public function noPayAction() { $currentPage = I('get.p', 1); //获取未支付订单数量 $relation = $this->relation; $map['is_payed'] = 0; $map['is_cancel'] = 0; $relation->setMap($map); $counts = $relation->getOrderCounts(); //获取分页信息 $page = $this->page; $page->setCounts($counts); $page->setCurrentPage($currentPage); $page->setPageSize(10); $pageSize = $page->getPageSize; $page->setPageStyle(2); $pageStr = $page->fetch(); $currentPage = $page->getCurrentPage(); //获取当前页未支付数据 $relation->setCurrentPage($currentPage); $relation->setPageSize($pageSize); $orderBy = array('creat_time' => "desc"); $relation->setOrderBy($orderBy); $noPayOrder = $relation->getCurrentPageOrder(); //获取当前支付订单下的所有订单信息 $orderForm = new OrderFormModel(); $key = 'id'; $resKey = '_detail'; $noPayOrder = $orderForm->getOrderByPayid($noPayOrder, $key, $resKey); //获取购买人信息 $customer = new CustomerModel(); $key = 'buy_openid'; $resKey = '_customer'; $noPayOrder = $customer->getCustomerByOpenid($noPayOrder, $key, $resKey); //添加URL信息 $noPayOrder = $this->_addNopayUrlInfo($noPayOrder, $currentPage); $this->assign('noPay', $noPayOrder); $this->assign('page', $pageStr); $this->assign('YZRight', $this->fetch()); $this->display(YZ_TEMPLATE); }
private function _getCurrentCustomerCurrentAchievement() { /* 取用户基本信息**** */ $openid = (string) $this->postObj->FromUserName; //获取当前周期的开始结束日期 $config = new ConfigModel(); $times = $config->getBeginTimeAndEndTime(); $beginTime = $times['endTime']; $endTime = time(); //取当期业绩信息中直销业绩 $relationForm = new OrderRelationModel(); $currentAchievement['direct'] = $relationForm->getAchievementByOpenid($openid, $beginTime, $endTime); //取出上线为自已的所有用户的业绩 $customer = new CustomerModel(); $openids = $customer->getLineOpenids($openid); $currentAchievement['line'] = $relationForm->getAchievementByOpenid($openids, $beginTime, $endTime); //添加直销,线销系数 $rebate = new RebateModel(); //取直销系数 $dataArr[0] = $currentAchievement['direct']; $key = '_totalGoodsFee'; $keyReturn = '_direct_radio'; $dataArr = $rebate->getRatioByMoney($dataArr, $key, $keyReturn); $currentAchievement['_direct_radio'] = $dataArr[0][$keyReturn]; //取线销系数 $dataArr[0] = $currentAchievement['line']; $keyReturn = '_line_radio'; $dataArr = $rebate->getRatioByMoney($dataArr, $key, $keyReturn); $currentAchievement['_line_radio'] = $dataArr[0][$keyReturn]; return $currentAchievement; }
public function responseSubscribeMsg() { //个性化二维码 if (isset($this->postObj->EventKey)) { $eventKey = (string) $this->postObj->EventKey; $pcid = substr($eventKey, 8); } else { $pcid = 0; } //取用户的基本信息 $openid = (string) $this->postObj->FromUserName; $accessToken = get_access_token(); $data = get_weichat_user_info($openid, $accessToken); //用出客户基本信息 //添加或更新用户信息 $customerInfo = get_customer_info($openid); $customer = new \Customer\Model\CustomerModel(); $data['subcribe_time'] = time(); if ($customerInfo == FALSE) { //进行注册送券活动 $this->_sentCouponForNewUser($openid, $pcid); //取上线用户信息 $oldCustomerInfo = $customer->getCustomerInfoById($pcid); if ($oldCustomerInfo != false) { $oldOpendid = $oldCustomerInfo['openid']; } else { $oldOpendid = ''; } //进行注册送红包活动 $SendRedGiftController = new SendRedGiftController(); $SendRedGiftController->sendRedGiftForCustomer($openid, $oldOpendid); //加上邀请码 $code = $customer->checkCode(); $data['parentid'] = $pcid; $data['customer_code'] = $code; } else { if ($customerInfo['parentid'] == 0) { $data['parentid'] = $pcid; } } $userInfo[] = $data; $customer->addUserInfo($userInfo); $reply = new ReplyModel(); $id = 1; $reply->setId($id); $message = $reply->getInfoById(); //获取附件信息 $attch = new AttachmentModel(); $key = 'picurl'; $attch->setKey($key); $attch->setInfo($message); $message = $attch->findInfo(); if ($message['news_type'] == 0) { $replyMessage = A('ReplyMessage'); $replyMessage->setText($message['description']); $replyMessage->replyTextMessage(); } elseif ($message['news_type'] == 1) { $replyMessage = A('ReplyMessage'); $data['title'] = $message['title']; $data['description'] = $message['description']; $data['url'] = $message['url']; $data['picurl'] = add_host($message[$key]['url']); $news[] = $data; $replyMessage->setNews($news); $replyMessage->replyNewsMessage(); } else { $replyMessage = A('ReplyMessage'); $replyMessage->setText('系统错误'); $replyMessage->replyTextMessage(); } return; }
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; } }
private function _getCustomerInfoByMap($map) { $customer = new CustomerModel(); $customer->setMap($map); $customerArr = $customer->getAllDataArrByMap(); $key = 'openid'; $customerArr = change_key($customerArr, $key); return $customerArr; }
public function indexAction() { /* 取用户基本信息**** */ $customerInfo = $this->customerInfo; //设置用户状态,用以显示“修改个人信息还是请完善个人信息” if (trim($customerInfo['phone_number']) == '' || trim($customerInfo['account']) == '') { $customerInfo['flag'] = 1; } else { $customerInfo['flag'] = 0; } $this->assign('customer', $customerInfo); $openid = get_openid(); //取订单数量 $orderForm = new OrderFormModel(); $noPayOrderCount = $orderForm->getNopayOrderCountByOpenid($openid); $payedOrderCount = $orderForm->getPayedOrderCountByOpenid($openid); //传订单数量数据 $this->assign('noPayOrderCount', $noPayOrderCount); $this->assign('payedOrderCount', $payedOrderCount); //获取当前周期的开始结束日期 $config = new ConfigModel(); $times = $config->getBeginTimeAndEndTime(); $beginTime = $times['endTime']; $endTime = time(); //取当期业绩信息中直销业绩 $relationForm = new OrderRelationModel(); $currentAchievement['direct'] = $relationForm->getAchievementByOpenid($openid, $beginTime, $endTime); //取出上线为自已的所有用户的业绩 $customer = new CustomerModel(); $openids = $customer->getLineOpenids($openid); $currentAchievement['line'] = $relationForm->getAchievementByOpenid($openids, $beginTime, $endTime); //添加直销,线销系数 $rebate = new RebateModel(); //取直销系数 $dataArr[0] = $currentAchievement['direct']; $key = '_totalGoodsFee'; $keyReturn = '_direct_radio'; $dataArr = $rebate->getRatioByMoney($dataArr, $key, $keyReturn); $currentAchievement['_direct_radio'] = $dataArr[0][$keyReturn]; //取线销系数 $dataArr[0] = $currentAchievement['line']; $keyReturn = '_line_radio'; $dataArr = $rebate->getRatioByMoney($dataArr, $key, $keyReturn); $currentAchievement['_line_radio'] = $dataArr[0][$keyReturn]; $this->assign('achievement', $currentAchievement); $changeUrl = U('ChangePhone/index'); $this->assign('changeUrl', $changeUrl); $account = U('Account/index'); $couponUrl = U('User/Coupon/index'); $this->assign('couponUrl', $couponUrl); $this->assign('wangqiurl', U('User/Achievement/pastData')); $finishedOrderUrl = U('UserCenter/OrderManage/finishedOrder'); $payedOrderUrl = U('UserCenter/OrderManage/payedOrder'); $unpayOrderUrl = U('UserCenter/OrderManage/unpayedOrder'); $allOrderUrl = U('UserCenter/OrderManage/allOrder'); $this->assign('finishedOrderUrl', $finishedOrderUrl); $this->assign('payedOrderUrl', $payedOrderUrl); $this->assign('unpayOrderUrl', $unpayOrderUrl); $this->assign('allOrderUrl', $allOrderUrl); $this->assign('count', $count); $css = $this->fetch('indexCss'); $this->assign('indexCss', $css); $this->assign("YZBody", $this->fetch()); $this->display(YZ_TEMPLATE); }