public function editAction()
 {
     $model = new ReplyModel();
     $pic = new AttachmentModel();
     //        $res = $model ->info();
     $rel = $model->all();
     $pic->setKey('picurl');
     $rel1 = $pic->findInfo($rel);
     $this->assign('reply', $rel1);
     $this->assign('id', $res);
     $this->assign('actionUrl', U(update));
     $this->assign('YZRight', $this->fetch());
     $this->display(YZ_TEMPLATE);
 }
예제 #2
0
 public function getGoodsArrByOrderIdArr($orderArr, $key, $resKey)
 {
     $attachment = new AttachmentModel();
     foreach ($orderArr as $k => $v) {
         $map['order_id'] = $v[$key];
         $res = $this->where($map)->select();
         //拼接图片链接信息
         foreach ($res as $ke => $va) {
             $pics = $va['focus_pictures'];
             $foucsPicIds = explode(',', $pics);
             $foucsPicId = $foucsPicIds[0];
             $res[$ke]['_pic'] = $attachment->getInfoById($foucsPicId);
         }
         $orderArr[$k][$resKey] = $res;
     }
     return $orderArr;
 }
 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;
 }