public function replyCode()
 {
     $openId = (string) $this->postObj->FromUserName;
     $customerInfo = get_customer_info($openId);
     $customerId = $customerInfo['id'];
     $url = 'https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=%s';
     $accessToken = get_access_token();
     $url = sprintf($url, $accessToken);
     $data['expire_seconds'] = 1800;
     $data['action_name'] = $this->actionName;
     $data['action_info'] = array('scene' => array('scene_id' => (int) $customerId));
     $data = json_encode($data);
     //                $replyMessage = A('ReplyMessage');
     //            $replyMessage->setText('传入的JSON数据为' . $data);
     //            $replyMessage->replyTextMessage();
     //            return;
     $res = http_post_json($url, $data);
     $res = json_decode($res);
     $ticket = $res->ticket;
     $ticket = urlencode($ticket);
     $replyMessage = A('ReplyMessage');
     $picUrl = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" . $ticket;
     $url = $picUrl;
     $title = '您的专属二维码';
     $description = '其它用户通过扫描该二维码关注我们,将自动成为您的朋友。';
     $news[] = array('title' => $title, 'description' => $description, 'picurl' => $picUrl, 'url' => $url);
     $replyMessage->setNews($news);
     $replyMessage->replyNewsMessage();
 }
 public function __construct()
 {
     parent::__construct();
     $openId = get_openid();
     //获取openid
     $customerInfo = get_customer_info($openId);
     $this->customerId = $customerInfo['id'];
 }
Exemplo n.º 3
0
 public function __construct()
 {
     $this->orderRelation = new OrderRelationModel();
     parent::__construct();
     $this->openId = get_openid();
     $custmoer = get_customer_info($this->openId);
     $this->id = $custmoer['id'];
 }
 public function __construct()
 {
     parent::__construct();
     $openId = get_openid();
     //获取openid
     $this->open_id = $openId;
     $this->customerInfo = get_customer_info($openId);
     $this->customerId = $this->customerInfo['id'];
     //        $config = D("Config");
     //        $configArr = $config->fetConfig();
     //        $this->beginDate = $configArr[0]['value'];
     //        $this->endDate = $configArr[1]['value'];
 }
 public function indexAction()
 {
     $customerInfo = get_customer_info(get_openid());
     $this->assign('customerType', $customerInfo['subscribe_state']);
     $this->assign('config_buy_max', $this->config_buy_max);
     $this->assign('config_buy_min', $this->config_buy_min);
     $this->assign('payNowUrl', U('OrderForm/Submit/index'));
     $addGoodsToCartUrl = U('Goods/GoodsDetail/add');
     $this->assign('addGoodsToCartUrl', $addGoodsToCartUrl);
     $this->assign('footer', '');
     $goods = new GoodsModel();
     $goodsId = I('get.goodsId');
     $goods->setGoodsId($goodsId);
     $res = $goods->getGoodsInf();
     if ($res == false || $res['state'] != 1) {
         $this->assign('js', $this->fetch('indexJs'));
         $this->assign('css', $this->fetch('indexCss'));
         $detail2 = $this->fetch('error');
         $this->assign('YZBody', $detail2);
         $this->display(YZ_TEMPLATE);
         return;
     }
     //计算运费
     //        if($res['logistics_mode'] == 0)
     //        {
     //            $logistic = new ConfigModel(); //运费配置
     //            $res['internation_transportation_expenses'] = $logistic->getFee($weightTotal);
     //        }
     //
     //获取来源国信息
     $source = new SourceModel();
     $map['id'] = $res['source'];
     $res['source'] = $source->getSource($map);
     $res['source']['icon_url'] = __ROOT__ . "/" . $res['source']['icon_url'];
     $logistic = new LogisticsModel();
     $key = 'logistics_mode';
     $data[0] = $res;
     $data = $logistic->getLogisticInfo($data, $key);
     $res = $data[0];
     $detail = $res;
     //        var_dump($detail);
     $this->assign('goods', $detail);
     $this->assign('js', $this->fetch('indexJs'));
     $this->assign('css', $this->fetch('indexCss'));
     $detail2 = $this->fetch('index');
     $this->assign('YZBody', $detail2);
     $this->display(YZ_TEMPLATE);
 }
Exemplo n.º 6
0
 private function _getTotal($settles)
 {
     $customer = array();
     foreach ($settles as $key => $value) {
         $payableTotal = 0;
         $directFeeTotal = 0;
         $customer[$key]['openid'] = get_customer_info($key);
         //汇总业绩
         foreach ($value as $k => $v) {
             $payableTotal += $v['payable'];
             $directFeeTotal += $v['direct_fee'];
         }
         $customer[$key]['payable'] = $payableTotal;
         $customer[$key]['directFee'] = $directFeeTotal;
         $customer[$key]['detail'] = $value;
         $this->rebate->setMoney($payableTotal);
         $customer[$key]['ratio'] = $this->rebate->getRadio();
     }
     return $customer;
 }
Exemplo n.º 7
0
 public function loadAction()
 {
     //分页加载方法
     $openid = get_openid();
     //如果不是注册用户不显示直销、线销
     $customerInfo = get_customer_info($openid);
     $this->assign('customerType', $customerInfo['subscribe_state']);
     $this->assign('goodsDetailUrl', $this->goodsDetailUrl);
     $this->assign('rootPath', $this->rootPath);
     $this->assign('postUrl', $this->url);
     $goodsList = new GoodsModel();
     $pageNum = I('get.pageNum');
     $nextPage = $pageNum + 1;
     //下页页码
     $goodsList->setPage($pageNum);
     $goodsList->setPageSize($this->pageSize);
     $count = $goodsList->getCount();
     $listNum = $this->pageSize * $pageNum;
     $listS = $goodsList->getDetailGoodsList();
     $listL = $this->_source($listS);
     //var_dump($list);
     $list = $this->_logistics($listL);
     $this->assign('nextPageNum', $nextPage);
     $this->assign('page', $this->fetch('page'));
     $this->assign('list', $list);
     $jsonData = array();
     if ($listNum < $count) {
         $jsonData['state'] = 1;
         //后面还有页
         $data_list = $this->fetch("Home@Xiaomi/list");
         $data_page = $this->fetch("Home@Xiaomi/page");
         $jsonData['list'] = $data_list;
         $jsonData['page'] = $data_page;
     } else {
         $jsonData['state'] = 0;
         //后边没有页了
         $data_list = $this->fetch('Home@Xiaomi/list');
         $jsonData['list'] = $data_list;
         $jsonData['page'] = 0;
     }
     $data = json_encode($jsonData);
     echo $data;
     //$this->display('list');
     //$this->ajaxReturn($jsonData);
 }
 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;
 }
Exemplo n.º 9
0
 public function registeAction()
 {
     $customer = new CustomerModel();
     $openId = I('get.openid', '');
     $checkCode = I('get.checkcode', '');
     $weixinId = I('get.weixinid', '');
     if ($openId == '' || $checkCode == '' || $weixinId == '') {
         return false;
     }
     //取用户信息
     $customerInfo = get_customer_info($openId);
     if ($customerInfo == false) {
         $customer->setOpenid($openId);
         $customer->addCustomer();
         $customerInfo = get_customer_info($openId);
     }
     $customerType = $customerInfo['subscribe_state'];
     //判断用户类型
     if ((int) $customerType & 1 == 1) {
         echo "请务重复注册";
         return;
     }
     if ($checkCode != session($openId . 'checkCode')) {
         echo "验证码错语";
         return;
     }
     if (time() - session($openId . 'lastTime') > 300) {
         echo "验证码已过期,请重新获取";
         return;
     }
     //用户状态更新
     $customer->setWeixinId($weixinId);
     $customer->updateState();
     //调用关注送券活动
     $active = new ActiveModel();
     $active->setopenId($openId);
     $accessToken = get_access_token();
     $data = get_weichat_user_info($openId, $accessToken);
     //用出客户基本信息
     //
     $obj = get_postObj();
     if (isset($obj->EventKey)) {
         $pcid = (int) $obj->EventKey;
     } else {
         $pcid = 0;
     }
     $data['parentid'] = $pcid;
     $active->setParentId($pcid);
     $active->subscribe();
     //
     echo "success";
 }
Exemplo n.º 10
0
                        $output = "報價單資料已儲存<br />";
                    }
                    /* ############################### */
                    /* ##### Sending Sales Order ##### */
                    $sender = "*****@*****.**";
                    $receipient = $data["email"];
                    $status = send_email($sender, $receipient, $data);
                    if ($status) {
                        $output .= "報價單已發送給客戶";
                    } else {
                        $output .= "報價單傳送發生錯誤";
                    }
                    /* ############################### */
                } else {
                    $cid = $data["select_cid"];
                    $data = get_customer_info($cid);
                }
            }
        }
        /* ################################ */
    }
}
/* ######################### */
/* ##### Function ##### */
function get_oid()
{
    /* ##### Get Order ID ##### */
    $query = "SELECT max(oid) FROM `server`.`order`";
    $result = mysql_query($query);
    while ($row = mysql_fetch_array($result)) {
        if (!empty($row['max(oid)'])) {